From: Wentao Liang <vulab@iscas.ac.cn>
To: Paul Ely <paul.ely@broadcom.com>
Cc: Justin Tee <justin.tee@broadcom.com>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
James Smart <james.smart@broadcom.com>,
Martin K. Petersen <mkp@kernel.org>,
Nigel Kirkland <nigel.kirkland@broadcom.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] scsi: lpfc: Fix ndlp reference leak in lpfc_release_rpi()
Date: Sat, 07 Nov 2026 15:17:28 +0000 [thread overview]
Message-ID: <1794064648.2620604.vulab@iscas.ac.cn> (raw)
In-Reply-To: <CAEQnVQn7fpgpm5zY=8ne0G5M_KXWg4qjecMK6smk-q+_0j1PEw@mail.gmail.com>
Hi Paul,
Sorry for answering so late. You asked me about the -EIO return a month
ago and I am only getting back to it now; that delay is on me.
You are right about it. lpfc_release_rpi() cannot tell a negative errno
from a mailbox status, and the value was outside the MBX_* code space the
rest of the function returns. lpfc_sli_issue_mbox_s4() now returns
MBXERR_ERROR for the non-polled command it cannot issue while interrupts
are disabled, which is also what lpfc_sli4_post_sync_mbox() returns when
it cannot post a command.
While going through the callers for that change I found one that does
depend on the sign: lpfc_bsg_issue_mbox() passes the raw result to bsg,
and bsg-lib only reports a negative result as an error, so a positive MBX
status reaches the ioctl caller as success. That is already true for
MBX_NOT_FINISHED today; 2/3 fixes it so that 3/3 does not add another way
to hit it.
The series is:
[PATCH v2 1/3] scsi: lpfc: Fix ndlp reference leak in lpfc_release_rpi()
[PATCH v2 2/3] scsi: lpfc: Report bsg mailbox failures as an errno
[PATCH v2 3/3] scsi: lpfc: Return MBX status when a non-polled mbox cannot be issued
1/3 is the patch you were testing. The check itself is unchanged; it is
still `rc != MBX_SUCCESS && rc != MBX_BUSY`, the test
lpfc_config_port_post() and lpfc_issue_hb_mbox() already use for the same
purpose, and it covers both -EIO and MBXERR_ERROR. I only rewrote the
comment above it. 3/3 is the change you asked for. I kept 1/3 apart
because it is the leak fix I would like in stable; 2/3 and 3/3 are not
stable candidates.
One thing I saw and did not touch: NLP_UNREG_INP is set before the issue
and is not cleared when the command is not handed to the port, so a later
lpfc_release_rpi() for the same node returns early at the "1435
release_rpi SKIP UNREG" message. That is pre-existing on the
MBX_NOT_FINISHED path too. Clearing it would make a second unreg possible
for the same NPort, so I would rather ask than guess - tell me if you want
it in this series.
Testing: I have no lpfc adapter, so this is build tested only. Mainline
at d48723711bae, drivers/scsi/lpfc/ builds with W=1 and no warnings.
checkpatch.pl --strict reports nothing on the three patches except
"unknown commit id" on the Fixes tag, which is an artifact of my shallow
checkout - 4430f7fd09ec is in mainline. I could not run it on hardware,
and the changelogs say so.
Thanks,
Wentao
next prev parent reply other threads:[~2026-11-07 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 14:47 [PATCH] scsi: lpfc: Fix ndlp reference leak in lpfc_release_rpi() Wentao Liang
2026-09-17 19:35 ` Paul Ely
2026-10-06 21:21 ` Paul Ely
2026-11-07 15:17 ` Wentao Liang [this message]
2026-11-07 16:16 ` [PATCH v2 1/3] " Wentao Liang
2026-11-07 16:16 ` [PATCH v2 2/3] scsi: lpfc: Report bsg mailbox failures as an errno Wentao Liang
2026-11-07 16:25 ` sashiko-bot
2026-11-07 16:16 ` [PATCH v2 3/3] scsi: lpfc: Return MBX status when a non-polled mbox cannot be issued Wentao Liang
2026-11-07 16:33 ` 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=1794064648.2620604.vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=James.Bottomley@hansenpartnership.com \
--cc=james.smart@broadcom.com \
--cc=justin.tee@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=nigel.kirkland@broadcom.com \
--cc=paul.ely@broadcom.com \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.