]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mmc: core: fix possible use after free of host
authorPan Bian <bianpan2016@163.com>
Wed, 17 Apr 2019 08:28:37 +0000 (16:28 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commit93374d900d19eebd743703de68ade99b8e2a116c
tree653dee5fe7fd3f14334a50b7dcd1c6ce2b181c26
parent63a825c28d4910f75e8f26465433436156311328
mmc: core: fix possible use after free of host

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 8e1943af2986db42bee2b8dddf49a36cdb2e9219 ]

In the function mmc_alloc_host, the function put_device is called to
release allocated resources when mmc_gpio_alloc fails. Finally, the
function pointed by host->class_dev.class->dev_release (i.e.,
mmc_host_classdev_release) is used to release resources including the
host structure. However, after put_device, host is used and released
again. Resulting in a use-after-free bug.

Fixes: 1ed217194488 ("mmc: core: fix error path in mmc_host_alloc")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/mmc/core/host.c