From: sashiko-bot@kernel.org
To: "Karan Tilak Kumar" <kartilak@cisco.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v6 09/13] scsi: fnic: Send NVMe LS requests through FDLS
Date: Fri, 24 Jul 2026 18:16:43 +0000 [thread overview]
Message-ID: <20260724181643.E26461F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724174811.5118-10-kartilak@cisco.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The driver fails to transmit an FC ABTS frame when aborting or timing out an NVMe LS request, but immediately frees the local OXID, leading to potential exchange corruption and cross-talk.
- [High] Missing bounds check on `ls_req->rqstlen` leads to a heap buffer overflow when copying the NVMe LS request payload into the fixed-size FC frame.
--
--- Patch [9]: [PATCH v6 09/13] scsi: fnic: Send NVMe LS requests through FDLS ---
commit c185a494dac754c12b5da24b26550de80039d738
Author: Karan Tilak Kumar <kartilak@cisco.com>
scsi: fnic: Send NVMe LS requests through FDLS
This commit adds the FC frame wrapper for NVMe LS requests and builds LS
request frames from the NVMe-FC transport callback. It allocates OXIDs,
tracks outstanding LS requests on the target port, and arms request timers.
Closes: https://lore.kernel.org/oe-kbuild-all/202605280619.pmobiDWp-lkp@intel.com/
> diff --git a/drivers/scsi/fnic/fnic_nvme.c b/drivers/scsi/fnic/fnic_nvme.c
> index 697a4fdfd576f..0b05dc9698be2 100644
> --- a/drivers/scsi/fnic/fnic_nvme.c
> +++ b/drivers/scsi/fnic/fnic_nvme.c
> @@ -1337,6 +1337,129 @@ void nvfnic_ls_req_timeout(struct timer_list *t)
> ls_req->done(ls_req, -ETIMEDOUT);
> }
[Severity: High]
Does this timeout handler fail to transmit an FC ABTS frame?
When an NVMe LS request times out or is aborted, the driver frees the OXID
back to the pool in nvfnic_ls_req_timeout() (and the corresponding abort
handler) but appears to skip sending an FC ABTS frame to the target to
terminate the exchange.
If the target is still processing the request, it may send a delayed response.
If the freed OXID is reused for a new request, could the target's delayed
response match the new request, misrouting the payload and causing data
corruption?
> +
> +/**
> + * nvfnic_ls_req_send - Send NVMe FC link service (LS) request
[ ... ]
> +int nvfnic_ls_req_send(struct nvme_fc_local_port *lport,
> + struct nvme_fc_remote_port *rport,
> + struct nvmefc_ls_req *ls_req)
> +{
[ ... ]
> + frame = fdls_alloc_frame(iport);
> + if (frame == NULL) {
> + FNIC_NVME_DBG(KERN_ERR, fnic,
> + "Failed to allocate frame to send NVME LS REQ");
> + spin_unlock_irqrestore(&fnic->fnic_lock, flags);
> + return -ENOMEM;
> + }
[ ... ]
> + ls_req_payload = frame + FNIC_ETH_FCOE_HDRS_OFFSET + sizeof(*fchdr);
> + memcpy(ls_req_payload, ls_req->rqstaddr, ls_req->rqstlen);
[Severity: High]
Does this code overflow the frame buffer?
The unchecked ls_req->rqstlen is directly used as the size parameter for
memcpy() into the fixed-size mempool buffer returned by fdls_alloc_frame().
If ls_req->rqstlen is larger than the available space in the frame, could
this cause a heap buffer overflow?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260724174811.5118-1-kartilak@cisco.com?part=9
next prev parent reply other threads:[~2026-07-24 18:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 17:47 [PATCH v6 00/13] Introduce functionality for NVMe initiator Karan Tilak Kumar
2026-07-24 17:47 ` [PATCH v6 01/13] scsi: fnic: Make debug logging protocol independent Karan Tilak Kumar
2026-07-24 18:16 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 02/13] scsi: fnic: Use fnic_num for non-SCSI identifiers Karan Tilak Kumar
2026-07-24 18:09 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 03/13] scsi: fnic: Decode firmware role configuration Karan Tilak Kumar
2026-07-24 18:07 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 04/13] scsi: fnic: Advertise NVMe initiator service parameters Karan Tilak Kumar
2026-07-24 18:05 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 05/13] scsi: fnic: Add FDLS role handling for NVMe initiators Karan Tilak Kumar
2026-07-24 18:54 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 06/13] scsi: fnic: Add the NVMe/FC transport path Karan Tilak Kumar
2026-07-24 18:20 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 07/13] scsi: fnic: Route completions and resets by initiator role Karan Tilak Kumar
2026-07-24 18:26 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 08/13] scsi: fnic: Handle NVMe LS frames in FDLS Karan Tilak Kumar
2026-07-24 18:17 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 09/13] scsi: fnic: Send NVMe LS requests through FDLS Karan Tilak Kumar
2026-07-24 18:16 ` sashiko-bot [this message]
2026-07-24 17:48 ` [PATCH v6 10/13] scsi: fnic: Abort timed-out NVMe LS requests Karan Tilak Kumar
2026-07-24 18:26 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 11/13] scsi: fnic: Track NVMe transport statistics Karan Tilak Kumar
2026-07-24 18:31 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 12/13] scsi: fnic: Expose NVMe transport state in debugfs Karan Tilak Kumar
2026-07-24 18:25 ` sashiko-bot
2026-07-24 17:48 ` [PATCH v6 13/13] scsi: fnic: Bump up version number Karan Tilak Kumar
2026-07-24 18:18 ` sashiko-bot
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=20260724181643.E26461F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kartilak@cisco.com \
--cc=linux-scsi@vger.kernel.org \
--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