]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
drivers: base: transport_class: fix possible memory leak
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 10 Nov 2022 10:23:07 +0000 (18:23 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:46:55 +0000 (16:46 +0100)
commitf3f081cfa82960a3b2697af76912984a74ed4a68
tree860c64928f83c808110a058bef7a09347ef9f30e
parent5b6bea3042ddd0c05e54ac0b8bbe7af3780afabc
drivers: base: transport_class: fix possible memory leak

BugLink: https://bugs.launchpad.net/bugs/2011425
[ Upstream commit a86367803838b369fe5486ac18771d14723c258c ]

Current some drivers(like iscsi) call transport_register_device()
failed, they don't call transport_destroy_device() to release the
memory allocated in transport_setup_device(), because they don't
know what was done, it should be internal thing to release the
resource in register function. So fix this leak by calling destroy
function inside register function.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221110102307.3492557-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
include/linux/transport_class.h