mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Junyoung Jang <graypanda.inzag@gmail.com>
To: Bradley Grove <linuxdrivers@attotech.com>
Cc: Junyoung Jang <graypanda.inzag@gmail.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <mkp@kernel.org>,
	Gwanhyun Lee <gwanhyunlee@gmail.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] scsi: esas2r: bound binary sysfs reads
Date: Thu,  3 Dec 2026 22:55:22 +0900	[thread overview]
Message-ID: <20261203135526.1026638-1-graypanda.inzag@gmail.com> (raw)

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


             reply	other threads:[~2026-12-03 13:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 13:55 Junyoung Jang [this message]
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

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=20261203135526.1026638-1-graypanda.inzag@gmail.com \
    --to=graypanda.inzag@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=gwanhyunlee@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxdrivers@attotech.com \
    --cc=mkp@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®