1
0
Fork 0

mmc: block: Fix use-after-free issue for rpmb

[ Upstream commit 202500d216 ]

The data structure member “rpmb->md” was passed to a call of the function
“mmc_blk_put” after a call of the function “put_device”. Reorder these
function calls to keep the data accesses consistent.

Fixes: 1c87f73578 ("mmc: block: Fix bug when removing RPMB chardev ")
Signed-off-by: Peng Hao <richard.peng@oppo.com>
Cc: stable@vger.kernel.org
[Uffe: Fixed up mangled patch and updated commit message]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Peng Hao 2020-05-22 09:29:25 +00:00 committed by Greg Kroah-Hartman
parent 2de6df8df9
commit a971f71e91
1 changed files with 1 additions and 1 deletions

View File

@ -2475,8 +2475,8 @@ static int mmc_rpmb_chrdev_release(struct inode *inode, struct file *filp)
struct mmc_rpmb_data *rpmb = container_of(inode->i_cdev,
struct mmc_rpmb_data, chrdev);
put_device(&rpmb->dev);
mmc_blk_put(rpmb->md);
put_device(&rpmb->dev);
return 0;
}