mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
[ Upstream commit fad92b1104
]
In the probe function, if the final 'serial_config()' fails, 'info' is
leaking.
Add a resource handling path to free this memory.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/dc25f96b7faebf42e60fe8d02963c941cf4d8124.1621971720.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7c3a170279
commit
cddee5c287
1 changed files with 10 additions and 1 deletions
|
@ -306,6 +306,7 @@ static int serial_resume(struct pcmcia_device *link)
|
|||
static int serial_probe(struct pcmcia_device *link)
|
||||
{
|
||||
struct serial_info *info;
|
||||
int ret;
|
||||
|
||||
dev_dbg(&link->dev, "serial_attach()\n");
|
||||
|
||||
|
@ -320,7 +321,15 @@ static int serial_probe(struct pcmcia_device *link)
|
|||
if (do_sound)
|
||||
link->config_flags |= CONF_ENABLE_SPKR;
|
||||
|
||||
return serial_config(link);
|
||||
ret = serial_config(link);
|
||||
if (ret)
|
||||
goto free_info;
|
||||
|
||||
return 0;
|
||||
|
||||
free_info:
|
||||
kfree(info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void serial_detach(struct pcmcia_device *link)
|
||||
|
|
Loading…
Reference in a new issue