Skip to content

Commit e7794c1

Browse files
ldtsstorulf
authored andcommitted
mmc: rpmb: fixes pause retune on all RPMB partitions.
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]>
1 parent 8c124d9 commit e7794c1

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
@@ -851,9 +851,10 @@ static const struct block_device_operations mmc_bdops = {
851851
static int mmc_blk_part_switch_pre(struct mmc_card *card,
852852
unsigned int part_type)
853853
{
854+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
854855
int ret = 0;
855856

856-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
857+
if ((part_type & mask) == mask) {
857858
if (card->ext_csd.cmdq_en) {
858859
ret = mmc_cmdq_disable(card);
859860
if (ret)
@@ -868,9 +869,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
868869
static int mmc_blk_part_switch_post(struct mmc_card *card,
869870
unsigned int part_type)
870871
{
872+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
871873
int ret = 0;
872874

873-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
875+
if ((part_type & mask) == mask) {
874876
mmc_retune_unpause(card->host);
875877
if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
876878
ret = mmc_cmdq_enable(card);
@@ -3145,4 +3147,3 @@ module_exit(mmc_blk_exit);
31453147

31463148
MODULE_LICENSE("GPL");
31473149
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
3148-

0 commit comments

Comments
 (0)