From: Mike Christie <michael.christie@oracle.com>
To: sashiko-reviews@lists.linux.dev, Ye Bin <yebin@huaweicloud.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH -next 1/2] scsi: iscsi: fix NULL pointer dereference in iscsi_sw_tcp_release_conn()
Date: Tue, 15 Sep 2026 15:07:37 -0500 [thread overview]
Message-ID: <048a642d-eb74-47ed-b39b-1932568731d2@oracle.com> (raw)
In-Reply-To: <20260821094757.45F171F00A3A@smtp.kernel.org>
On 8/21/26 4:47 AM, sashiko-bot@kernel.org wrote:
>
>> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
>> index 8aa76f813bcdb..aea319c1e72fe 100644
>> --- a/drivers/scsi/scsi_transport_iscsi.c
>> +++ b/drivers/scsi/scsi_transport_iscsi.c
>> @@ -2278,35 +2280,36 @@ static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag)
>
> [ ... ]
>
>> - /*
>> - * Only clear for recovery to avoid extra cleanup runs during
>> - * termination.
>> - */
>> - spin_lock_irq(&conn->lock);
>> - clear_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags);
>> - spin_unlock_irq(&conn->lock);
>> - }
>> + } else {
>> + iscsi_stop_conn(conn, flag);
>> + }
>> +
>> + spin_lock_irq(&conn->lock);
>> + clear_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags);
>> + spin_unlock_irq(&conn->lock);
>
> [Severity: High]
> Does this unconditionally clear ISCSI_CLS_CONN_BIT_CLEANUP during
> STOP_CONN_TERM?
>
> The original code avoided clearing this bit during termination, as the removed
> comment explicitly noted.
>
> If a connection error queues iscsi_cleanup_conn_work_fn(), which unbinds the
> endpoint (setting conn->ep = NULL), and then userspace initiates termination
> via iscsi_if_stop_conn(conn, STOP_CONN_TERM), iscsi_if_disconnect_bound_ep()
> won't be called here because conn->ep is NULL.
>
> When this bit is subsequently cleared unconditionally, and userspace later issues
> an event to disconnect the endpoint, will iscsi_if_disconnect_bound_ep() skip
> releasing the workqueue's reference?
Ye Bin, were you working on a update to this patchset? I don't think sashiko is
correct here.
Because ISCSI_CLS_CONN_BIT_CLEANUP is set we will not queue new cleanup work while
iscsi_if_stop_conn is running. Once that is done we clear the bit and if we
reconnec again the conn->state is BOUND/UP then we can set the bit again and queue
cleanup work.
next prev parent reply other threads:[~2026-09-15 20:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 9:24 [PATCH -next 0/2] scsi: iscsi: Fix races in connection cleanup path Ye Bin
2026-08-21 9:24 ` [PATCH -next 1/2] scsi: iscsi: fix NULL pointer dereference in iscsi_sw_tcp_release_conn() Ye Bin
2026-08-21 9:47 ` sashiko-bot
2026-09-15 20:07 ` Mike Christie [this message]
2026-08-21 9:24 ` [PATCH -next 2/2] scsi: iscsi: Fix use-after-free in iscsi_conn_release() for cleanup_work Ye Bin
2026-08-21 9:49 ` sashiko-bot
2026-09-15 20:49 ` Mike Christie
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=048a642d-eb74-47ed-b39b-1932568731d2@oracle.com \
--to=michael.christie@oracle.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yebin@huaweicloud.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