]> git.baikalelectronics.ru Git - kernel.git/commit
ipmi: kcs_bmc: Fix a memory leak in the error handling path of 'kcs_bmc_serio_add_dev...
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 7 Sep 2021 21:06:32 +0000 (23:06 +0200)
committerCorey Minyard <cminyard@mvista.com>
Fri, 29 Oct 2021 12:23:59 +0000 (07:23 -0500)
commit8aa27cb859d78342b2ec9cfa2c1b1aaa95af2991
tree07a0e9c6f68243f19d7ff67a11c0453c70fdede2
parent7d9ce8799b0ba3468c3cbfae114cc64256c6bea8
ipmi: kcs_bmc: Fix a memory leak in the error handling path of 'kcs_bmc_serio_add_device()'

In the unlikely event where 'devm_kzalloc()' fails and 'kzalloc()'
succeeds, 'port' would be leaking.

Test each allocation separately to avoid the leak.

Fixes: f4fddfd1e6a6 ("ipmi: kcs_bmc: Add serio adaptor")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Message-Id: <ecbfa15e94e64f4b878ecab1541ea46c74807670.1631048724.git.christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
drivers/char/ipmi/kcs_bmc_serio.c