Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp916182rdb; Fri, 1 Dec 2023 01:56:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYiYO2ZguxUZqPjULE2hAPARpt2DW7pIttPb6Hj89xlPoUNoNfLlztVdWHdNsunvIZXssL X-Received: by 2002:a05:6a00:c96:b0:6ce:8ce:2b04 with SMTP id a22-20020a056a000c9600b006ce08ce2b04mr461434pfv.23.1701424611526; Fri, 01 Dec 2023 01:56:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701424611; cv=none; d=google.com; s=arc-20160816; b=It83BzJpk+GsK7kX8uiOnpZH3jAbOwjVHaxXFnKIqdmotrcKFoitkG0aIAnU2dkeUp YB9OTMTLkvlDJjadDNC1ytiejEGs7qvRykX/7Z+E9yZBASwgltoeEDHv0xrzqdt3wBol XI7ML+crTrVWSvcWMI1T6AUa96IyFZG/7Z/ALBOei9jhmVSPzq6vayW31mgQqHtUeaXE e4iT6OFnorfGqrelXQcmE8KiGatYCgxejUzNq/nLxVLYbtMZi7gTRWrka9yjXQYILxHp zZ+g0M54lzmhKXGXYYBrEm8jhsLF23fPKMmOp4MTwZuKK8fJx1s4NJyYsQVvGWzXd8H0 M/Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=imgzYGiqQhIIN9pgZ0mud47x5443YmKclZtZpKeB2ec=; fh=7ln2ObqKk3vxI/AfGlDtNBW15N/TJIZnC2y+BVeuZ0E=; b=KOiRVMeIbFuroFsCNt5C1cG/+l1MRbcS5gt4RS++Txjpfd7OEhm9PtQJZNXleHPmPi 0JsXLghgZWLRiHucy8XmunJl0QnabVDija8PnyqjqGlmDml1Rfb68TInI9+5UiDRa3Fq OzbHy/HJeBiqCBueoXC38jRvNmQV8qZmTfVh57dFDN2f9fIxOpSERkv8gWz0L6qJa94/ MCK78L+orPAtaZtHi6FEPTw3zBffPd+vMYL6lXgiZ0yk9FZv3k4EuoigUs8Wuu15H+RC tb1B88xdcXlP2OPIBKIGBSqzY6l8EZtPFRw79LWK5PDgHtL1YTMZNdueYlzZsBa8bi75 K9pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foundries.io header.s=google header.b=GGFpYQ25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=foundries.io Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id q3-20020a656843000000b005b969f7e4b0si3143725pgt.377.2023.12.01.01.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:56:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@foundries.io header.s=google header.b=GGFpYQ25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=foundries.io Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CEE10809B774; Fri, 1 Dec 2023 01:56:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378034AbjLAJ4I (ORCPT + 99 others); Fri, 1 Dec 2023 04:56:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377899AbjLAJ4H (ORCPT ); Fri, 1 Dec 2023 04:56:07 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A476910D7 for ; Fri, 1 Dec 2023 01:56:13 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40b595bf5d2so15002755e9.2 for ; Fri, 01 Dec 2023 01:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; t=1701424572; x=1702029372; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=imgzYGiqQhIIN9pgZ0mud47x5443YmKclZtZpKeB2ec=; b=GGFpYQ25N72u8lCbtYsLxrIiSTXFWvgnp4ewKQNg1p+Z8/II5IcafVWofDjrRRr3cY Cr0aaKGYvro+psN8Hfw9LeUOPWPHHXTo6Hm+l8zel77Da8EobdIPPSAmDzH6qiAbhRim 8kU2r4cNKkCIJbOd8ZfuL/0dRiDOg695Unz0s9NwVGTgOrtv1f/wHOiG9Ktl9TQwv7ma N1LcHn/sf1UjHuowtq7Q1Px3qbMZHOzKVHQxI7ZrfSxREuhlQxnTY2qMCPUXlL95v7Kg iAtWJUPplgnxCJZFJ8LcdU/kUHlIctcnPSkxNqhFjylDprJDGhWnXJBHtcx1uX/UifbC 2iuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701424572; x=1702029372; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=imgzYGiqQhIIN9pgZ0mud47x5443YmKclZtZpKeB2ec=; b=siVFULy3yYrI4IIbakbHmXDHmHk4u8LlAD/buWUcr6v78qEYk30oGgwFvU7MckjD3b DeXqI0iUb3Xd3OmCcWytOrH+gOkHr0jcAPerpF0NCI2O+96q/31G7PO2bvYAgaTeYoVl e16TVzs6VcEeONQBgYMPPhzrTXHKO4L1hjT6NShWbLUmIYahap+prkMTFwWGehS1b0wr GxUhMa32oIEwdsi23kxuH5ypx7Z0who4Vj3WAWtygK63yXoyzV+U6tR0kgVHyoB62tLi IBBOHJ2PNE6FboQc/zSATVzbJI28UgzVW5qDMQbSq6wAuZZPl57zztATLgr6pHcO7MH5 6lLA== X-Gm-Message-State: AOJu0YwY3Wa9LrxUFnI6UDMAkrkW/Y++wdaLKmXCVbInXkDMUk2HUx8n Yr5c46GNMN2m0AkUv4fPQqcdew== X-Received: by 2002:a05:600c:1f91:b0:40b:5433:17ef with SMTP id je17-20020a05600c1f9100b0040b543317efmr196223wmb.30.1701424572074; Fri, 01 Dec 2023 01:56:12 -0800 (PST) Received: from trax.. (139.red-79-144-198.dynamicip.rima-tde.net. [79.144.198.139]) by smtp.gmail.com with ESMTPSA id h7-20020adf9cc7000000b0032d8eecf901sm3802982wre.3.2023.12.01.01.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:56:11 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, ulf.hansson@linaro.org, linus.walleij@linaro.org Cc: adrian.hunter@intel.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCHv2] mmc: rpmb: fixes pause retune on all RPMB partitions. Date: Fri, 1 Dec 2023 10:56:08 +0100 Message-Id: <20231201095608.1022191-1-jorge@foundries.io> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:56:30 -0800 (PST) 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 --- drivers/mmc/core/block.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 152dfe593c43..13093d26bf81 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); @@ -3143,4 +3145,3 @@ module_exit(mmc_blk_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver"); - -- 2.34.1