milos-linux/drivers/target
Carlos Bilbao 2f3835771d scsi: target: iscsi: reject invalid size Extended CDB AHS
If ecdb_ahdr->ahslength is zero, two bugs follow:

  kmalloc(be16_to_cpu(ecdb_ahdr->ahslength) + 15, ...)

allocates 15 bytes, but the immediately following memcpy writes
ISCSI_CDB_SIZE (16) bytes into it, a one-byte heap overflow. Also:

  memcpy(cdb + ISCSI_CDB_SIZE, ecdb_ahdr->ecdb,
           be16_to_cpu(ecdb_ahdr->ahslength) - 1);

(u16)0 - 1 promotes to (int)-1 which converts to SIZE_MAX as size_t,
causing a massive out-of-bounds write.

Reject ahslength == 0 with ISCSI_REASON_PROTOCOL_ERROR before the kmalloc.
Also reject ahslength values that exceed the actual AHS buffer advertised.

Fixes: 8f1f7d297b ("scsi: target: iscsi: Add support for extended CDB AHS")
Signed-off-by: Carlos Bilbao <carlos.bilbao@kernel.org>
Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://patch.msgid.link/20260415040728.187680-1-carlos.bilbao@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2026-04-21 21:08:25 -04:00
..
iscsi scsi: target: iscsi: reject invalid size Extended CDB AHS 2026-04-21 21:08:25 -04:00
loopback Merge branch 7.0/scsi-fixes into 7.1/scsi-staging 2026-04-02 20:31:22 -04:00
sbp scsi: target: Use driver completion preference by default 2026-02-28 21:04:02 -05:00
tcm_fc scsi: target: Use driver completion preference by default 2026-02-28 21:04:02 -05:00
tcm_remote Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Kconfig
Makefile
target_core_alua.c
target_core_alua.h
target_core_configfs.c scsi: target: configfs: Bound snprintf() return in tg_pt_gp_members_show() 2026-04-13 22:43:56 -04:00
target_core_device.c scsi: target: core: Fix complete_type use 2026-03-10 21:32:01 -04:00
target_core_fabric_configfs.c scsi: target: Allow userspace to set the completion type 2026-02-28 21:04:03 -05:00
target_core_fabric_lib.c kernel.h: drop hex.h and update all hex.h users 2026-01-20 19:44:19 -08:00
target_core_file.c scsi: target: file: Use kzalloc_flex for aio_cmd 2026-03-19 22:07:39 -04:00
target_core_file.h
target_core_hba.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
target_core_iblock.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
target_core_iblock.h scsi: target: iblock: Allow iblock devices to be shared 2025-07-24 21:39:01 -04:00
target_core_internal.h scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_pr.c scsi: target: Don't validate ignored fields in PROUT PREEMPT 2026-04-08 22:38:18 -04:00
target_core_pr.h
target_core_pscsi.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
target_core_pscsi.h
target_core_rd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
target_core_rd.h
target_core_sbc.c scsi: target: core: Fix integer overflow in UNMAP bounds check 2026-03-10 21:56:39 -04:00
target_core_spc.c SCSI misc on 20260212 2026-02-12 15:43:02 -08:00
target_core_stat.c scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_tmr.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
target_core_tpg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
target_core_transport.c scsi: target: Replace strncpy() with strscpy() in VPD dump functions 2026-03-27 16:32:44 -04:00
target_core_ua.c
target_core_ua.h
target_core_user.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
target_core_xcopy.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
target_core_xcopy.h