mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: HyeongJun An <sammiee5311@gmail.com>
Cc: Mike Christie <michael.christie@oracle.com>,
	 Lee Duncan <lduncan@suse.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	 "James E . J . Bottomley"
	<James.Bottomley@hansenpartnership.com>,
	open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] scsi: libiscsi_tcp: bound SCSI Response data segment to the connection buffer
Date: Thu, 16 Jul 2026 06:50:01 -0700	[thread overview]
Message-ID: <20260716-tinsel-detective-7953f0311400@redhat.com> (raw)
In-Reply-To: <20260716065848.1653431-1-sammiee5311@gmail.com>

On Thu, Jul 16, 2026 at 03:58:48PM +0900, HyeongJun An wrote:
> iscsi_tcp_hdr_dissect() receives the data segment of several PDU types
> into the fixed-size conn->data buffer, which is allocated for
> ISCSI_DEF_MAX_RECV_SEG_LEN (8192) bytes.  For the LOGIN_RSP, TEXT_RSP,
> REJECT and ASYNC_EVENT opcodes the dissect path already rejects a PDU
> whose DataSegmentLength exceeds that buffer.
> 
> The SCSI Command Response (ISCSI_OP_SCSI_CMD_RSP) path also copies its
> data segment (sense/response data) into conn->data via
> iscsi_tcp_data_recv_prep(), but it does so without the same check.  The
> only upstream bound on in.datalen is conn->max_recv_dlength, the
> initiator's advertised MaxRecvDataSegmentLength, which is commonly
> negotiated well above 8192 (open-iscsi defaults to 262144).  A target
> that returns a SCSI Response with a DataSegmentLength between 8193 and
> max_recv_dlength therefore overflows the 8192-byte conn->data buffer.
> 
> Once the same bound applies, ISCSI_OP_SCSI_CMD_RSP is handled exactly
> like those responses: bound the data segment, receive it into conn->data
> when present, and otherwise complete the PDU with no data.  Fold the
> opcode into that case group rather than duplicating the check.
> 
> Fixes: a081c13e39b5 ("[SCSI] iscsi_tcp: split module into lib and lld")
> Suggested-by: Chris Leech <cleech@redhat.com>
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
> ---
> v2: Fold ISCSI_OP_SCSI_CMD_RSP into the LOGIN_RSP/TEXT_RSP/REJECT/
>     ASYNC_EVENT case group instead of duplicating the bounds check, as
>     suggested by Chris Leech.  The handling is identical: both bound the
>     data segment to conn->data, receive it when present, and otherwise
>     complete the PDU with no data (the latter via the LOGOUT_RSP
>     fallthrough).  No functional change from v1.
> 
> v1: https://lore.kernel.org/all/20260710050645.1194212-1-sammiee5311@gmail.com/
> 
>  drivers/scsi/libiscsi_tcp.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Acked-by: Chris Leech <cleech@redhat.com>


  reply	other threads:[~2026-07-16 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10  5:06 [PATCH] " HyeongJun An
2026-07-16  6:26 ` Chris Leech
2026-07-16  6:58 ` [PATCH v2] " HyeongJun An
2026-07-16 13:50   ` Chris Leech [this message]
2026-07-29  2:56   ` Martin K. Petersen

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=20260716-tinsel-detective-7953f0311400@redhat.com \
    --to=cleech@redhat.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=open-iscsi@googlegroups.com \
    --cc=sammiee5311@gmail.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

all inboxes | Powered by JetHome®