summaryrefslogtreecommitdiff
path: root/drivers/memstick/core
diff options
context:
space:
mode:
authorQinglang Miao <miaoqinglang@huawei.com>2020-11-20 15:48:46 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-29 13:46:55 +0100
commitba327081d8bdc40b2b4843fd852680f2dabfdd70 (patch)
treef8e3f5d44c0c1c41b5b67f602b0fc02ace0d1b5d /drivers/memstick/core
parent44ada2f76ae761de80de7cb1f14b814a5c91da0a (diff)
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>
Diffstat (limited to 'drivers/memstick/core')
-rw-r--r--drivers/memstick/core/memstick.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index b1564cacd19e..20ae8652adf4 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -469,7 +469,6 @@ static void memstick_check(struct work_struct *work)
host->card = card;
if (device_register(&card->dev)) {
put_device(&card->dev);
- kfree(host->card);
host->card = NULL;
}
} else