Skip to content

Commit 202500d

Browse files
Peng Haostorulf
authored andcommitted
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: 1c87f73 ("mmc: block: Fix bug when removing RPMB chardev ") Signed-off-by: Peng Hao <[email protected]> Cc: [email protected] [Uffe: Fixed up mangled patch and updated commit message] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 2b17b8d commit 202500d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mmc/core/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2484,8 +2484,8 @@ static int mmc_rpmb_chrdev_release(struct inode *inode, struct file *filp)
24842484
struct mmc_rpmb_data *rpmb = container_of(inode->i_cdev,
24852485
struct mmc_rpmb_data, chrdev);
24862486

2487-
put_device(&rpmb->dev);
24882487
mmc_blk_put(rpmb->md);
2488+
put_device(&rpmb->dev);
24892489

24902490
return 0;
24912491
}

0 commit comments

Comments
 (0)