mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] scsi: esas2r: bound binary sysfs reads
@ 2026-12-03 13:55 Junyoung Jang
  2026-12-03 13:55 ` [PATCH 1/2] scsi: esas2r: bound default_nvram reads to the requested count Junyoung Jang
  2026-12-03 13:55 ` [PATCH 2/2] scsi: esas2r: bound owner-only binary sysfs reads Junyoung Jang
  0 siblings, 2 replies; 3+ messages in thread
From: Junyoung Jang @ 2026-12-03 13:55 UTC (permalink / raw)
  To: Bradley Grove
  Cc: Junyoung Jang, James E.J. Bottomley, Martin K. Petersen,
	Gwanhyun Lee, linux-scsi, linux-kernel

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


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

end of thread, other threads:[~2026-12-03 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 13:55 [PATCH 0/2] scsi: esas2r: bound binary sysfs reads Junyoung Jang
2026-12-03 13:55 ` [PATCH 1/2] scsi: esas2r: bound default_nvram reads to the requested count Junyoung Jang
2026-12-03 13:55 ` [PATCH 2/2] scsi: esas2r: bound owner-only binary sysfs reads Junyoung Jang

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®