From: sashiko-bot@kernel.org
To: "WenTao Liang" <vulab@iscas.ac.cn>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: qla2xxx: fix refcount leak in qla24xx_async_prli()
Date: Thu, 11 Jun 2026 11:21:54 +0000 [thread overview]
Message-ID: <20260611112154.E81801F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260611110919.74911-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Double-decrement (underflow) of `vha->vref_count` on the error path of `qla24xx_async_prli()`.
--
commit 96156510fc7447ae3d281225a3388973efa74abd
Author: WenTao Liang <vulab@iscas.ac.cn>
scsi: qla2xxx: fix refcount leak in qla24xx_async_prli()
This commit attempts to fix a vha refcount leak in the error path of
qla24xx_async_prli by explicitly calling QLA_VHA_MARK_NOT_BUSY(vha) after
releasing the command kref.
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index e746c9274cded..8dd717dfcc144 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -1352,6 +1352,7 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport)
> done_free_sp:
> /* ref: INIT */
> kref_put(&sp->cmd_kref, qla2x00_sp_release);
> + QLA_VHA_MARK_NOT_BUSY(vha);
[Severity: High]
Does this result in a double-decrement of the vha refcount?
Looking at the release callback chain, kref_put() calls qla2x00_sp_release(),
which unconditionally calls sp->free(sp).
During initialization, qla2x00_init_async_sp() sets the free callback to
qla2x00_sp_free(), which then calls qla2x00_rel_sp(). Finally,
qla2x00_rel_sp() calls QLA_VHA_MARK_NOT_BUSY(sp->vha).
If the refcount is already decremented by the kref_put() callback chain:
kref_put()
qla2x00_sp_release()
qla2x00_sp_free()
qla2x00_rel_sp()
QLA_VHA_MARK_NOT_BUSY()
Does adding an explicit call here cause an underflow?
> fcport->flags &= ~FCF_ASYNC_SENT;
> return rval;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611110919.74911-1-vulab@iscas.ac.cn?part=1
prev parent reply other threads:[~2026-06-11 11:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 11:09 [PATCH] scsi: qla2xxx: fix refcount leak in qla24xx_async_prli() WenTao Liang
2026-06-11 11:21 ` 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=20260611112154.E81801F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vulab@iscas.ac.cn \
/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