mirror-linux/drivers/target
Kery Qi b2d6b1d443 scsi: firewire: sbp-target: Fix overflow in sbp_make_tpg()
The code in sbp_make_tpg() limits "tpgt" to UINT_MAX but the data type of
"tpg->tport_tpgt" is u16. This causes a type truncation issue.

When a user creates a TPG via configfs mkdir, for example:

    mkdir /sys/kernel/config/target/sbp/<wwn>/tpgt_70000

The value 70000 passes the "tpgt > UINT_MAX" check since 70000 is far less
than 4294967295. However, when assigned to the u16 field tpg->tport_tpgt,
the value is silently truncated to 4464 (70000 & 0xFFFF). This causes the
value the user specified to differ from what is actually stored, leading to
confusion and potential unexpected behavior.

Fix this by changing the type of "tpgt" to u16 and using kstrtou16() which
will properly reject values outside the u16 range.

Fixes: a511ce3397 ("sbp-target: Initial merge of firewire/ieee-1394 target mode support")
Signed-off-by: Kery Qi <qikeyu2017@gmail.com>
Link: https://patch.msgid.link/20260121114515.1829-2-qikeyu2017@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2026-01-23 22:41:21 -05:00
..
iscsi scsi: target: iscsi: Fix use-after-free in iscsit_dec_session_usage_count() 2026-01-16 23:02:15 -05:00
loopback scsi: target: tcm_loop: Fix segfault in tcm_loop_tpg_address_show() 2025-11-08 12:30:02 -05:00
sbp scsi: firewire: sbp-target: Fix overflow in sbp_make_tpg() 2026-01-23 22:41:21 -05:00
tcm_fc scsi: target: Add WQ_PERCPU to alloc_workqueue() users 2025-11-12 21:28:27 -05:00
tcm_remote
Kconfig
Makefile
target_core_alua.c
target_core_alua.h
target_core_configfs.c SCSI misc on 20251204 2025-12-05 19:56:50 -08:00
target_core_device.c Merge patch series "target: RW/num_cmds stats improvements" 2025-11-02 22:07:27 -05:00
target_core_fabric_configfs.c scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_fabric_lib.c
target_core_file.c scsi: target: Rename target_configure_unmap_from_queue() 2025-11-02 21:40:01 -05:00
target_core_file.h
target_core_hba.c
target_core_iblock.c scsi: target: Add atomic support to target_core_iblock 2025-11-02 21:40:02 -05:00
target_core_iblock.h
target_core_internal.h scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_pr.c
target_core_pr.h
target_core_pscsi.c
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c scsi: target: Add WRITE_ATOMIC_16 handler 2025-11-02 21:40:02 -05:00
target_core_spc.c scsi: target: Add WRITE_ATOMIC_16 support to RSOC 2025-11-02 21:40:02 -05: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
target_core_tpg.c scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_transport.c scsi: target: Reset t_task_cdb pointer in error case 2025-11-29 15:06:12 -05:00
target_core_ua.c
target_core_ua.h
target_core_user.c
target_core_xcopy.c scsi: target: Add WQ_PERCPU to alloc_workqueue() users 2025-11-12 21:28:27 -05:00
target_core_xcopy.h