Skip to content

Commit bfc3720

Browse files
ldtsgregkh
authored andcommitted
mmc: rpmb: fixes pause retune on all RPMB partitions.
commit e7794c1 upstream. When RPMB was converted to a character device, it added support for multiple RPMB partitions (Commit 9754857 ("mmc: block: Convert RPMB to a character device"). One of the changes in this commit was transforming the variable target_part defined in __mmc_blk_ioctl_cmd into a bitmask. This inadvertently regressed the validation check done in mmc_blk_part_switch_pre() and mmc_blk_part_switch_post(), so let's fix it. Fixes: 9754857 ("mmc: block: Convert RPMB to a character device") Signed-off-by: Jorge Ramirez-Ortiz <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 77359c4 commit bfc3720

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/mmc/core/block.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,10 @@ static const struct block_device_operations mmc_bdops = {
850850
static int mmc_blk_part_switch_pre(struct mmc_card *card,
851851
unsigned int part_type)
852852
{
853+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
853854
int ret = 0;
854855

855-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
856+
if ((part_type & mask) == mask) {
856857
if (card->ext_csd.cmdq_en) {
857858
ret = mmc_cmdq_disable(card);
858859
if (ret)
@@ -867,9 +868,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
867868
static int mmc_blk_part_switch_post(struct mmc_card *card,
868869
unsigned int part_type)
869870
{
871+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
870872
int ret = 0;
871873

872-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
874+
if ((part_type & mask) == mask) {
873875
mmc_retune_unpause(card->host);
874876
if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
875877
ret = mmc_cmdq_enable(card);
@@ -3091,4 +3093,3 @@ module_exit(mmc_blk_exit);
30913093

30923094
MODULE_LICENSE("GPL");
30933095
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
3094-

0 commit comments

Comments
 (0)