From: sashiko-bot@kernel.org
To: "Ziheng Wei" <zihengw03@163.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: lpfc: avoid post-loop iterator use in lpfc_sli_process_unsol_iocb()
Date: Sat, 05 Dec 2026 08:04:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-251254@kernel.org> (raw)
In-Reply-To: <20261205074457.84293-1-zihengw03@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: lpfc: lpfc_sli_process_unsol_iocb() dispatches orphaned
CONT64 IOCB
--
commit 512b23b139e6040d1e5f73875f3035d605cf2039
Author: Ziheng Wei <zihengw03@163.com>
scsi: lpfc: avoid post-loop iterator use in lpfc_sli_process_unsol_iocb()
This commit sets iocbq = saveq when no matching entry is found on
pring->iocb_continue_saveq in lpfc_sli_process_unsol_iocb(), avoiding
post-loop iterator use when saveq->iocb.ulpStatus is not
IOSTAT_INTERMED_RSP.
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index 9173263c87f93..8bf28619d7d03 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -3566,9 +3566,11 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
> break;
> }
> }
> - if (!found)
> + if (!found) {
> list_add_tail(&saveq->clist,
> &pring->iocb_continue_saveq);
> + iocbq = saveq;
> + }
>
> if (saveq->iocb.ulpStatus != IOSTAT_INTERMED_RSP) {
> list_del_init(&iocbq->clist);
[Severity: Medium]
Should an orphaned CMD_IOCB_RCV_CONT64_CX IOCB be dispatched as a standalone
sequence here?
Reaching the ulpStatus != IOSTAT_INTERMED_RSP branch with !found only happens
for a CMD_IOCB_RCV_CONT64_CX continuation whose sequence head is missing from
pring->iocb_continue_saveq. Setting iocbq = saveq queues and immediately
unlinks saveq, then falls through to process it as a sequence-start IOCB.
Downstream code assumes saveq is a sequence-start IOCB. NPIV vport lookup
skips CMD_IOCB_RCV_CONT64_CX and leaves traffic on phba->pport, and handlers
like lpfc_els_unsol_buffer() parse mid-sequence payload bytes as an ELS
command while reading rcv_seq64 word 5 fields as the remote NPort DID.
If lpfc_complete_unsol_iocb() finds no matching handler, returning 1 also
leaks saveq->cmd_dmabuf and saveq->bpl_dmabuf.
When !found and saveq->iocb.ulpStatus != IOSTAT_INTERMED_RSP, freeing
saveq->cmd_dmabuf and saveq->bpl_dmabuf with lpfc_in_buf_free() and returning
1 would drop the orphaned continuation IOCB instead of dispatching it.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205074457.84293-1-zihengw03@163.com?part=1
prev parent reply other threads:[~2026-12-05 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 7:44 [PATCH] scsi: lpfc: avoid post-loop iterator use in lpfc_sli_process_unsol_iocb() Ziheng Wei
2026-12-05 8:04 ` 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=sashiko-outbox-251254@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zihengw03@163.com \
/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