Skip to content

Commit 575e127

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 9c5efaa commit 575e127

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
@@ -866,9 +866,10 @@ static const struct block_device_operations mmc_bdops = {
866866
static int mmc_blk_part_switch_pre(struct mmc_card *card,
867867
unsigned int part_type)
868868
{
869+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
869870
int ret = 0;
870871

871-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
872+
if ((part_type & mask) == mask) {
872873
if (card->ext_csd.cmdq_en) {
873874
ret = mmc_cmdq_disable(card);
874875
if (ret)
@@ -883,9 +884,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
883884
static int mmc_blk_part_switch_post(struct mmc_card *card,
884885
unsigned int part_type)
885886
{
887+
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
886888
int ret = 0;
887889

888-
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
890+
if ((part_type & mask) == mask) {
889891
mmc_retune_unpause(card->host);
890892
if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
891893
ret = mmc_cmdq_enable(card);
@@ -3180,4 +3182,3 @@ module_exit(mmc_blk_exit);
31803182

31813183
MODULE_LICENSE("GPL");
31823184
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
3183-

0 commit comments

Comments
 (0)