From: sashiko-bot@kernel.org
To: "WenTao Liang" <vulab@iscas.ac.cn>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] fix: scsi: srp_reconnect_rport: unbalanced scsi_block_targets/scsi_target_unblock
Date: Fri, 26 Jun 2026 16:18:07 +0000 [thread overview]
Message-ID: <20260626161807.F3DC01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626161402.55116-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing curly braces around the `if` block causes `blocked = true;` to execute unconditionally, defeating the intended fix.
--
commit c11303cf8aa2900f23dfb0d36f22857ab2b9cb38
Author: WenTao Liang <vulab@iscas.ac.cn>
fix: scsi: srp_reconnect_rport: unbalanced scsi_block_targets/scsi_target_unblock
This commit introduces a blocked flag to srp_reconnect_rport() to track
if scsi_block_targets() was called. This is intended to prevent an extra
scsi_target_unblock() call which results in an unbalanced kref_put.
> diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
> index a61cbb079ab4e..d7c2608b73ef3 100644
> --- a/drivers/scsi/scsi_transport_srp.c
> +++ b/drivers/scsi/scsi_transport_srp.c
[ ... ]
> @@ -549,6 +550,7 @@ int srp_reconnect_rport(struct srp_rport *rport)
> * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK.
> */
> scsi_block_targets(shost, &shost->shost_gendev);
> + blocked = true;
[Severity: High]
Does this missing brace cause the blocked flag to be set unconditionally?
Looking at srp_reconnect_rport(), the preceding if statement lacks curly
braces:
if (rport->state != SRP_RPORT_FAIL_FAST && rport->state != SRP_RPORT_LOST)
/* ... */
scsi_block_targets(shost, &shost->shost_gendev);
blocked = true;
Because blocked = true is treated as a separate sequential statement, it will
execute regardless of the rport->state check.
Does this entirely defeat the fix by leaving the unbalanced
scsi_target_unblock() reference counting issue active?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260626161402.55116-1-vulab@iscas.ac.cn?part=1
next prev parent reply other threads:[~2026-06-26 16:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 16:14 [PATCH] fix: scsi: srp_reconnect_rport: unbalanced scsi_block_targets/scsi_target_unblock WenTao Liang
2026-06-26 16:18 ` sashiko-bot [this message]
2026-06-26 16:50 ` James Bottomley
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=20260626161807.F3DC01F000E9@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 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.