From: "Pradhan, Sanman" <sanman.pradhan@hpe.com>
To: Srinivas Kandagatla <srini@kernel.org>,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Freeman Liu <freeman.liu@unisoc.com>,
"Maxime Ripard" <mripard@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Sanman Pradhan <psanman@juniper.net>
Subject: [PATCH v2 0/2] nvmem: validate access ranges and fix SPRD reads
Date: Mon, 21 Sep 2026 16:51:24 +0000 [thread overview]
Message-ID: <20260921165055.421933-1-sanman.pradhan@hpe.com> (raw)
From: Sanman Pradhan <psanman@juniper.net>
Patch 1 adds a device-size bounds check to the two nvmem core read/write
functions, so an out-of-range request is rejected before it reaches a
provider. v1 open-coded this check in the sprd driver; this version puts
it in the core instead.
Patch 2 fixes sprd_efuse_read(), which reads one four-byte block but
copies the caller's full length from that stack variable, and never
advances past the first block. Its provider-side range check is removed
in favour of patch 1, so patch 2 should be applied after patch 1:
without the core check an out-of-range in-kernel request would let the
new block loop read past the eFuse region.
Both patches are compile-tested only. No Spreadtrum eFuse hardware was
available for runtime testing. The bounds check intentionally permits a
zero-length access at offset == size and rejects all ranges extending
past the device size.
Link for v1:https://lore.kernel.org/all/20260904003815.462352-1-sanman.pradhan@hpe.com/
Sanman Pradhan (2):
nvmem: core: reject reads and writes beyond the device size
nvmem: sprd: fix out-of-bounds read in sprd_efuse_read()
drivers/nvmem/core.c | 6 ++++++
drivers/nvmem/sprd-efuse.c | 17 ++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
--
2.34.1
next reply other threads:[~2026-09-21 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 16:51 Pradhan, Sanman [this message]
2026-09-21 16:51 ` [PATCH v2 1/2] nvmem: core: reject reads and writes beyond the device size Pradhan, Sanman
2026-09-21 16:51 ` [PATCH v2 2/2] nvmem: sprd: fix out-of-bounds read in sprd_efuse_read() Pradhan, Sanman
2026-11-27 11:44 ` [PATCH v2 0/2] nvmem: validate access ranges and fix SPRD reads Srinivas Kandagatla
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=20260921165055.421933-1-sanman.pradhan@hpe.com \
--to=sanman.pradhan@hpe.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=freeman.liu@unisoc.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=orsonzhai@gmail.com \
--cc=psanman@juniper.net \
--cc=srini@kernel.org \
--cc=zhang.lyra@gmail.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
all inboxes | Powered by JetHome®