]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:33:11 +0000 (07:33 +0100)
commitf666d466d12ea72c9aa7e9188749852fa19ac530
tree8ec23c81f929720aeb88757f696b79c9736bcfe4
parent1d663824c09361dd96a48aa83dd16c16eb7e472d
ipmi: kcs_bmc: Fix a memory leak in the error handling path of 'kcs_bmc_serio_add_device()'

BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit f281d010b87454e72475b668ad66e34961f744e0 ]

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

Test each allocation separately to avoid the leak.

Fixes: 3a3d2f6a4c64 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/char/ipmi/kcs_bmc_serio.c