diff options
author | Peng Hao <richard.peng@oppo.com> | 2020-05-22 09:29:25 +0000 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2020-05-25 10:45:17 +0200 |
commit | 202500d21654874aa03243e91f96de153ec61860 (patch) | |
tree | 1015cdcac9853fb6d34e28a0f4f660f80716ca54 /drivers/mmc/core | |
parent | 2b17b8d7cc65d333a48c6d32ee44fc489cecb7d9 (diff) |
mmc: block: Fix use-after-free issue for rpmb
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: 1c87f7357849 ("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>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r-- | drivers/mmc/core/block.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index c5367e2c8487..7896952de1ac 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2484,8 +2484,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; } |