Commit e3e9ced5 authored by Qinglang Miao's avatar Qinglang Miao Committed by Ulf Hansson
Browse files

memstick: fix a double-free bug in memstick_check



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

Fixes: 0193383a ("memstick: core: fix device_register() error handling")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20201120074846.31322-1-miaoqinglang@huawei.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent bf3023e6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -468,7 +468,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