mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] nvmem: validate access ranges and fix SPRD reads
@ 2026-09-21 16:51 Pradhan, Sanman
  2026-09-21 16:51 ` [PATCH v2 1/2] nvmem: core: reject reads and writes beyond the device size Pradhan, Sanman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pradhan, Sanman @ 2026-09-21 16:51 UTC (permalink / raw)
  To: Srinivas Kandagatla, Orson Zhai, Baolin Wang
  Cc: Chunyan Zhang, Greg Kroah-Hartman, Freeman Liu, Maxime Ripard,
	linux-kernel, Sanman Pradhan

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-27 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 16:51 [PATCH v2 0/2] nvmem: validate access ranges and fix SPRD reads Pradhan, Sanman
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

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®