[PATCH 0/2] scsi: esas2r: bound binary sysfs reads
From: Junyoung Jang
Date: Thu Dec 03 2026 - 08:55:37 EST
esas2r exposes default_nvram as a mode-0444 binary sysfs attribute. A
1-byte read passes a 1-byte kernfs buffer to read_default_nvram(),
which writes the full 256-byte NVRAM structure into it.
Patch 1 builds the defaults on the stack and uses
memory_read_from_buffer() to honor count and off. Patch 2 bounds the
copies in the mode-0600 live_nvram and hw read callbacks to count while
keeping their offset-ignoring behavior so write-then-read exchanges on
a single fd keep working without a seek.
In separate QEMU KASAN runs, a dummy SCSI host registered
bin_attr_default_nvram or bin_attr_live_nvram. A 1-byte read of each
attribute caused a 256-byte slab-out-of-bounds write before the fix
and returned 1 byte without a KASAN report afterward. Physical ATTO
hardware was unavailable, so read_hw() was only build-tested.
Junyoung Jang (2):
scsi: esas2r: bound default_nvram reads to the requested count
scsi: esas2r: bound owner-only binary sysfs reads
drivers/scsi/esas2r/esas2r_main.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.43.0