mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-12 03:26:26 +00:00
memstick: fix a double-free bug in memstick_check
[ Upstream commite3e9ced5c9
] kfree(host->card) has been called in put_device so that another kfree would raise cause a double-free bug. Fixes:0193383a58
("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>
This commit is contained in:
parent
44ada2f76a
commit
ba327081d8
1 changed files with 0 additions and 1 deletions
|
@ -469,7 +469,6 @@ static void memstick_check(struct work_struct *work)
|
||||||
host->card = card;
|
host->card = card;
|
||||||
if (device_register(&card->dev)) {
|
if (device_register(&card->dev)) {
|
||||||
put_device(&card->dev);
|
put_device(&card->dev);
|
||||||
kfree(host->card);
|
|
||||||
host->card = NULL;
|
host->card = NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue