From: Jorge Ramirez-Ortiz <jorge@foundries.io>
To: jorge@foundries.io, ulf.hansson@linaro.org,
CLoehle@hyperstone.com, adrian.hunter@intel.com,
jinpu.wang@ionos.com, hare@suse.de, beanhuo@micron.com,
asuk4.q@gmail.com, yangyingliang@huawei.com,
yibin.ding@unisoc.com, victor.shih@genesyslogic.com.tw,
linus.walleij@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mmc: rpmb: fixes pause retune on all RPMB partitions.
Date: Fri, 1 Dec 2023 10:10:34 +0100 [thread overview]
Message-ID: <20231201091034.936441-1-jorge@foundries.io> (raw)
When RPMB was converted to a character device, it added support for
multiple RPMB partitions (Commit 97548575bef3 ("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 inadvertedly regressed the validation check done in
mmc_blk_part_switch_pre() and mmc_blk_part_switch_post().
This commit fixes that regression.
Fixes: 97548575bef3 ("mmc: block: Convert RPMB to a character device")
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---
drivers/mmc/core/block.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 152dfe593c43..8d29687635c4 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -851,9 +851,10 @@ static const struct block_device_operations mmc_bdops = {
static int mmc_blk_part_switch_pre(struct mmc_card *card,
unsigned int part_type)
{
+ const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
int ret = 0;
- if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
+ if (part_type & mask == mask) {
if (card->ext_csd.cmdq_en) {
ret = mmc_cmdq_disable(card);
if (ret)
@@ -868,9 +869,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
static int mmc_blk_part_switch_post(struct mmc_card *card,
unsigned int part_type)
{
+ const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
int ret = 0;
- if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
+ if (part_type & mask == mask) {
mmc_retune_unpause(card->host);
if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
ret = mmc_cmdq_enable(card);
--
2.34.1
next reply other threads:[~2023-12-01 9:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 9:10 Jorge Ramirez-Ortiz [this message]
2023-12-01 9:28 ` [PATCH] mmc: rpmb: fixes pause retune on all RPMB partitions Linus Walleij
2023-12-01 9:39 ` Jorge Ramirez-Ortiz, Foundries
[not found] ` <CAJ1nHOW9T3yvFj5FFdOZYrdgfy0f=opiDri+2srE=yBp5vtVZw@mail.gmail.com>
2023-12-01 13:18 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231201091034.936441-1-jorge@foundries.io \
--to=jorge@foundries.io \
--cc=CLoehle@hyperstone.com \
--cc=adrian.hunter@intel.com \
--cc=asuk4.q@gmail.com \
--cc=beanhuo@micron.com \
--cc=hare@suse.de \
--cc=jinpu.wang@ionos.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=victor.shih@genesyslogic.com.tw \
--cc=yangyingliang@huawei.com \
--cc=yibin.ding@unisoc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox