From: sashiko-bot@kernel.org
To: "Nihar Panda" <niharp@linux.ibm.com>
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org,
"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH 3/3] zfcp: trace return values of sysfs unit add store
Date: Thu, 11 Jun 2026 05:31:14 +0000 [thread overview]
Message-ID: <20260611053114.7602F1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260611050550.796772-5-niharp@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Uninitialized stack variable `fcp_lun` is logged to the debugfs trace buffer when `kstrtoull()` fails, leaking kernel stack memory.
--
commit 907efa1a4b46ed7f2ac643c1a75f4e115a834154
Author: Chinmaya Kajagar <chinmayk@linux.ibm.com>
zfcp: trace return values of sysfs unit add store
This commit adds tracing for zfcp sysfs unit add failures to help debug
cases where the kernel cannot add a LUN. It records the wwpn, fcp lun id,
return value, and associated hba of the device.
> diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
> --- a/drivers/s390/scsi/zfcp_sysfs.c
> +++ b/drivers/s390/scsi/zfcp_sysfs.c
[ ... ]
> @@ -442,17 +442,24 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
> const char *buf, size_t count)
> {
> struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
> + struct zfcp_adapter *adapter = port->adapter;
> u64 fcp_lun;
> - int retval;
> + int retval = -EINVAL;
>
> - if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
> - return -EINVAL;
> + if (kstrtoull(buf, 0, (unsigned long long *)&fcp_lun)) {
> + zfcp_dbf_hba_uas("syuast1", 3, adapter, port->wwpn,
> + fcp_lun, retval);
[Severity: Medium]
Is there a risk of leaking kernel stack memory into the trace buffer here?
If kstrtoull() fails to parse the input string, it returns an error and
leaves the stack-allocated fcp_lun unmodified.
Since fcp_lun is uninitialized, this trace call passes 8 bytes of
uninitialized stack memory to zfcp_dbf_hba_uas(), which might expose it
via the DBF trace ring buffer and result in misleading garbage LUN values
in the log.
> + return retval;
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611050550.796772-1-niharp@linux.ibm.com?part=3
prev parent reply other threads:[~2026-06-11 5:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 5:05 Nihar Panda
2026-06-11 5:05 ` [PATCH 0/3] zfcp: Enhanced tracing for debugging Nihar Panda
2026-06-11 5:05 ` [PATCH 1/3] zfcp: Enhance fsf status read buffer tracing Nihar Panda
2026-06-11 5:26 ` sashiko-bot
2026-06-11 5:05 ` [PATCH 2/3] zfcp: Trace plogi and prli within open port response as payload Nihar Panda
2026-06-11 5:24 ` sashiko-bot
2026-06-11 5:05 ` [PATCH 3/3] zfcp: trace return values of sysfs unit add store Nihar Panda
2026-06-11 5:31 ` sashiko-bot [this message]
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=20260611053114.7602F1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=niharp@linux.ibm.com \
--cc=sashiko-reviews@lists.linux.dev \
/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