memstick: fix a double-free bug in memstick_check
authorQinglang Miao <miaoqinglang@huawei.com>
Fri, 20 Nov 2020 07:48:46 +0000 (15:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:20 +0000 (11:53 +0100)
commit365a94fc1e3d0c78df67b39b819ceb645b96b391
treee2948321bda4a3c68ddc9401278956a039a49edf
parentc802d9e5e69d9f631a9f126a2b645f2fbac4858f
memstick: fix a double-free bug in memstick_check

[ Upstream commit e3e9ced5c93803d5b2ea1942c4bf0192622531d6 ]

kfree(host->card) has been called in put_device so that
another kfree would raise cause a double-free bug.

Fixes: 0193383a5833 ("memstick: core: fix device_register() error handling")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20201120074846.31322-1-miaoqinglang@huawei.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/memstick/core/memstick.c