From: Lee Jones <lee@kernel.org>
To: lee@kernel.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Carlo Caione <carlo@endlessm.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Kevin Hilman <khilman@baylibre.com>,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Srinivas Kandagatla <srini@kernel.org>
Subject: [PATCH 01/10] nvmem: meson-efuse: Reject negative or zero SMC size in meson_efuse_probe()
Date: Thu, 3 Dec 2026 08:26:02 +0000 [thread overview]
Message-ID: <cad4c44a40b888575f1978d2245d40af6b9d8121.1796286324.git.lee@kernel.org> (raw)
In-Reply-To: <cover.1796286324.git.lee@kernel.org>
meson_sm_call() writes the signed Secure Monitor return value into its
s32 output pointer and returns 0 whenever the command ID is valid.
meson_efuse_probe() passes an unsigned int pointer to meson_sm_call()
and only checks for a negative return value from meson_sm_call() itself.
If firmware returns a negative SMC error code (such as
SMCCC_RET_NOT_SUPPORTED), size wraps to a large unsigned value and is
assigned to econfig->size.
Change size to s32 and reject negative or zero values from
SM_EFUSE_USER_MAX with -EINVAL.
Fixes: ad855eae6caf ("nvmem: amlogic: Add Amlogic Meson EFUSE driver")
Closes: https://sashiko.dev/#/bug/linux-0667e60b-53c5-4a5a-b9b4-bb6f8d7eb500
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
Cc: Carlo Caione <carlo@endlessm.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: linux-amlogic@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Srinivas Kandagatla <srini@kernel.org>
drivers/nvmem/meson-efuse.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c
index d7f9ac99a212..e8f384098be5 100644
--- a/drivers/nvmem/meson-efuse.c
+++ b/drivers/nvmem/meson-efuse.c
@@ -51,7 +51,7 @@ static int meson_efuse_probe(struct platform_device *pdev)
struct nvmem_device *nvmem;
struct nvmem_config *econfig;
struct clk *clk;
- unsigned int size;
+ s32 size;
struct device_node *sm_np __free(device_node) =
of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0);
@@ -68,7 +68,8 @@ static int meson_efuse_probe(struct platform_device *pdev)
if (IS_ERR(clk))
return dev_err_probe(dev, PTR_ERR(clk), "failed to get efuse gate");
- if (meson_sm_call(fw, SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) {
+ if (meson_sm_call(fw, SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0 ||
+ size <= 0) {
dev_err(dev, "failed to get max user");
return -EINVAL;
}
--
2.56.1.911.g883d8bcb20-goog
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-12-03 8:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:26 [PATCH 00/10] nvmem: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03 8:26 ` Lee Jones [this message]
2026-12-03 8:26 ` [PATCH 09/10] nvmem: meson-efuse: Detect short reads and writes from Secure Monitor Lee Jones
2026-12-03 8:54 ` sashiko-bot
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=cad4c44a40b888575f1978d2245d40af6b9d8121.1796286324.git.lee@kernel.org \
--to=lee@kernel.org \
--cc=carlo@endlessm.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=srini@kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®