From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 3/3] scsi: libiscsi: validate the task named by a management response
Date: Tue, 04 Aug 2026 04:33:31 +0000 [thread overview]
Message-ID: <20260804043332.3BEE01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804040546.2264137-4-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] iscsi_complete_pdu() acquires session->lock with spin_lock(), but can be called from process context, leading to a deadlock against softirqs.
--
--- Patch [3]: [PATCH v2 3/3] scsi: libiscsi: validate the task named by a management response ---
commit 5135af06e5540d3c52932cc2310608b06242c034
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
scsi: libiscsi: validate the task named by a management response
__iscsi_complete_pdu() fetches the task for five response types from one
place and checks only that the index resolved. This commit fixes an issue
where task->conn could be NULL by requiring the task to be in flight and
not a SCSI command.
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index f6e7facf296b2..b686cd2aa4dd2 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -1180,7 +1180,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
> case ISCSI_OP_SCSI_TMFUNC_RSP:
> case ISCSI_OP_NOOP_IN:
> task = iscsi_itt_to_task(conn, hdr->itt);
> - if (!task)
> + if (!task || task->state == ISCSI_TASK_FREE || task->sc)
[Severity: High]
This is a pre-existing issue, but could the lock usage in the caller lead
to a deadlock?
Looking at iscsi_complete_pdu() (which calls __iscsi_complete_pdu()), it uses
spin_lock(&conn->session->lock) instead of spin_lock_bh().
If qla4xxx_task_work() in drivers/scsi/qla4xxx/ql4_os.c is called from
a workqueue (process context), it calls iscsi_complete_pdu() without disabling
softirqs:
drivers/scsi/qla4xxx/ql4_os.c:qla4xxx_task_work() {
...
iscsi_complete_pdu(conn, hdr, data, data_len);
...
}
If a timer interrupt fires on the same CPU while the lock is held, the timer
softirq callback iscsi_check_transport_timeouts() will attempt to acquire the
same lock, resulting in a lock inversion deadlock:
drivers/scsi/libiscsi.c:iscsi_check_transport_timeouts() {
...
spin_lock(&session->lock);
...
}
Should iscsi_complete_pdu() use spin_lock_bh() to prevent this?
> return ISCSI_ERR_BAD_ITT;
> break;
> default:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804040546.2264137-1-yhlee@isslab.korea.ac.kr?part=3
next prev parent reply other threads:[~2026-08-04 4:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 4:05 [PATCH v2 0/3] scsi: libiscsi: validate task lookups driven by target-supplied ITTs Yehyeong Lee
2026-08-04 4:05 ` [PATCH v2 1/3] scsi: libiscsi: reject a negative task index from parse_pdu_itt Yehyeong Lee
2026-08-04 4:05 ` [PATCH v2 2/3] scsi: libiscsi: validate the ITT reflected in a Reject PDU Yehyeong Lee
2026-08-04 4:30 ` sashiko-bot
2026-08-04 4:05 ` [PATCH v2 3/3] scsi: libiscsi: validate the task named by a management response Yehyeong Lee
2026-08-04 4:33 ` sashiko-bot [this message]
2026-08-04 6:24 ` [PATCH v2 0/3] scsi: libiscsi: validate task lookups driven by target-supplied ITTs Yehyeong Lee
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=20260804043332.3BEE01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yhlee@isslab.korea.ac.kr \
/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.