mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Yehyeong Lee <yhlee@isslab.korea.ac.kr>,
	lduncan@suse.com, cleech@redhat.com,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 3/3] scsi: libiscsi: validate the task named by a management response
Date: Tue, 6 Oct 2026 19:15:38 -0500	[thread overview]
Message-ID: <06ac2254-99e3-47d7-bc92-79ea7b581238@oracle.com> (raw)
In-Reply-To: <20260804040546.2264137-4-yhlee@isslab.korea.ac.kr>

On 8/3/26 11:05 PM, Yehyeong Lee wrote:
> __iscsi_complete_pdu() fetches the task for five response types from one
> place and checks only that the index resolved:
> 
>       case ISCSI_OP_LOGOUT_RSP:
>       case ISCSI_OP_LOGIN_RSP:
>       case ISCSI_OP_TEXT_RSP:
>       case ISCSI_OP_SCSI_TMFUNC_RSP:
>       case ISCSI_OP_NOOP_IN:
>               task = iscsi_itt_to_task(conn, hdr->itt);
>               if (!task)
>                       return ISCSI_ERR_BAD_ITT;
> 
> iscsi_itt_to_task() bounds the index against cmds_max and looks at
> nothing else, so a target can name any slot in the pool, including one
> that has never been used. task->conn is then NULL, and both
> iscsi_nop_out_rsp() and iscsi_complete_task() dereference it. One
> unsolicited NOP-In is enough; a Text Response carrying the same ITT
> crashes in iscsi_complete_task() instead.
> 
> Require the task to be in flight and not a SCSI command, the way
> iscsi_itt_to_ctask() does for the command opcodes.
> 
> [    6.298634] Oops: general protection fault, probably for non-canonical address 0xdffffc000000000c: 0000 [#1] SMP KASAN NOPTI
> [    6.298642] KASAN: null-ptr-deref in range [0x0000000000000060-0x0000000000000067]
> [    6.298652] CPU: 1 UID: 0 PID: 111 Comm: iscsistart Not tainted 7.2.0-rc5-ISCSI1-gf5098b6bae76 #1 PREEMPT(lazy)
> [    6.298654] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
> [    6.298656] RIP: 0010:iscsi_nop_out_rsp.constprop.0+0x46/0x160
> [    6.298691] Code: c1 ea 03 48 83 ec 08 80 3c 02 00 0f 85 f5 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 6b 58 48 8d 7d 60 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 c0 00 00 00 48 8b 45 60 48 39 c3 74 50 48 b8 00
> [    6.298698] RSP: 0018:ffff88806c907be8 EFLAGS: 00010206
> [    6.298701] RAX: dffffc0000000000 RBX: ffff888006116800 RCX: 0000000000000020
> [    6.298702] RDX: 000000000000000c RSI: ffff88800525d578 RDI: 0000000000000060
> [    6.298703] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
> [    6.298706] R10: 0000000000000020 R11: 0000000000000000 R12: 0000000000000000
> [    6.298706] R13: 000000000000002e R14: ffff8880056eb440 R15: ffff888006116800
> [    6.298707] FS:  00007fc02d1c2740(0000) GS:ffff8880b29bc000(0000) knlGS:0000000000000000
> [    6.298710] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    6.298711] CR2: 000055fe3b56ddf8 CR3: 00000000053b9004 CR4: 0000000000770ef0
> [    6.298712] PKRU: 55555554
> [    6.298713] Call Trace:
> [    6.298714]  <IRQ>
> [    6.298714]  __iscsi_complete_pdu+0x13a8/0x22a0
> [    6.298758]  iscsi_complete_pdu+0x54/0xa0
> [    6.298759]  iscsi_tcp_hdr_recv_done+0x870/0x2c80
> [    6.298778]  iscsi_tcp_recv_skb+0x31e/0xec0
> [    6.298800]  iscsi_sw_tcp_recv+0x12f/0x390
> [    6.298804]  __tcp_read_sock+0x1ab/0x810
> [    6.298812]  iscsi_sw_tcp_data_ready+0x18b/0x510
> [    6.298814]  tcp_rcv_established+0x1f56/0x3a00
> [    6.298842]  tcp_v4_do_rcv+0x449/0x960
> [    6.298847]  tcp_v4_rcv+0x2245/0x3bc0
> 
> Fixes: 7996a778ff8c ("[SCSI] iscsi: add libiscsi")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Reviewed-by: Mike Christie <michael.christie@oracle.com>


  reply	other threads:[~2026-10-07  0:15 UTC|newest]

Thread overview: 8+ 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-10-07  0:08   ` Mike Christie
2026-08-04  4:05 ` [PATCH v2 2/3] scsi: libiscsi: validate the ITT reflected in a Reject PDU Yehyeong Lee
2026-10-07  0:14   ` Mike Christie
2026-08-04  4:05 ` [PATCH v2 3/3] scsi: libiscsi: validate the task named by a management response Yehyeong Lee
2026-10-07  0:15   ` Mike Christie [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=06ac2254-99e3-47d7-bc92-79ea7b581238@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=cleech@redhat.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=open-iscsi@googlegroups.com \
    --cc=stable@vger.kernel.org \
    --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 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®