All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: ghuicao@163.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3] scsi: target: iscsi: Reject CDB size exceeding available buffer
Date: Thu, 27 Aug 2026 01:44:45 +0000	[thread overview]
Message-ID: <20260827014446.664561F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827013245.21289-1-ghuicao@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The iSCSI target RX path fails to include Additional Header Segments (AHS) when computing the received HeaderDigest, breaking CRC verification for valid PDUs with AHS.
--

commit 6cf5aacf20580909d513380590652bf27da173c3
Author: Cao Guanghui <caoguanghui@kylinos.cn>

scsi: target: iscsi: Reject CDB size exceeding available buffer

This commit adds validation to ensure the CDB size requested by
scsi_command_size() and the Extended CDB length do not exceed available
buffers. It prevents out-of-bounds reads during memcpy in
target_cmd_init_cdb() and fortify_source panics when an Extended CDB AHS
is present.

> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 62ada3a52210e..f19f1c31a39b2 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but since this code correctly
handles AHS structures, I noticed a pre-existing issue in the iSCSI target
RX path that might also need addressing.

In iscsit_get_rx_pdu(), does the header digest calculation need to be updated
to include the AHS length?

drivers/target/iscsi/iscsi_target.c:iscsit_get_rx_pdu() {
    ...
			checksum = iscsit_crc_buf(buffer, ISCSI_HDR_LEN, 0,
						  NULL);
    ...
}

Doesn't this calculate the CRC exclusively over the 48-byte basic header
(ISCSI_HDR_LEN)?

If the initiator negotiates HeaderDigest and sends an iSCSI PDU with an
Additional Header Segment (hdr->hlength > 0), wouldn't this break CRC
verification for valid PDUs with AHS since they will be falsely rejected
with a CRC error?

According to RFC 3720 Section 10.2.1.2, shouldn't the Header Digest be
calculated over the basic header AND any AHS, using
ISCSI_HDR_LEN + (hdr->hlength * 4) instead of just ISCSI_HDR_LEN?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827013245.21289-1-ghuicao@163.com?part=1

  reply	other threads:[~2026-08-27  1:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 10:05 [PATCH v2] scsi: target: iscsi: Reject CDB size exceeding available buffer in iscsit_setup_scsi_cmd ghuicao
2026-08-26 10:23 ` sashiko-bot
2026-08-27  1:32 ` [PATCH v3] scsi: target: iscsi: Reject CDB size exceeding available buffer ghuicao
2026-08-27  1:44   ` sashiko-bot [this message]
2026-08-27  6:42   ` [PATCH v4 1/2] " ghuicao
2026-08-27  6:42     ` [PATCH v4 2/2] scsi: target: iscsi: Fix HeaderDigest to cover AHS data ghuicao

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=20260827014446.664561F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ghuicao@163.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.