android_kernel_motorola_sm6375/drivers/target
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Wang Haoran e6eeee5dc0 scsi: target: target_core_configfs: Add length check to avoid buffer overflow
commit 27e06650a5eafe832a90fd2604f0c5e920857fae upstream.

A buffer overflow arises from the usage of snprintf to write into the
buffer "buf" in target_lu_gp_members_show function located in
/drivers/target/target_core_configfs.c. This buffer is allocated with
size LU_GROUP_NAME_BUF (256 bytes).

snprintf(...) formats multiple strings into buf with the HBA name
(hba->hba_group.cg_item), a slash character, a devicename (dev->
dev_group.cg_item) and a newline character, the total formatted string
length may exceed the buffer size of 256 bytes.

Since snprintf() returns the total number of bytes that would have been
written (the length of %s/%sn ), this value may exceed the buffer length
(256 bytes) passed to memcpy(), this will ultimately cause function
memcpy reporting a buffer overflow error.

An additional check of the return value of snprintf() can avoid this
buffer overflow.

Reported-by: Wang Haoran <[email protected]>
Reported-by: ziiiro <[email protected]>
Signed-off-by: Wang Haoran <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2025-10-29 13:59:44 +01:00
..
iscsi scsi: target: iscsi: Fix timeout on deleted connection 2025-06-04 14:32:29 +02:00
loopback
sbp
tcm_fc
Kconfig
Makefile
target_core_alua.c
target_core_alua.h
target_core_configfs.c scsi: target: target_core_configfs: Add length check to avoid buffer overflow 2025-10-29 13:59:44 +01:00
target_core_device.c
target_core_fabric_configfs.c
target_core_fabric_lib.c
target_core_file.c scsi: target: Fix WRITE_SAME No Data Buffer crash 2025-06-04 14:32:26 +02:00
target_core_file.h
target_core_hba.c
target_core_iblock.c scsi: target: Fix WRITE_SAME No Data Buffer crash 2025-06-04 14:32:26 +02:00
target_core_iblock.h
target_core_internal.h
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: Fix WRITE_SAME No Data Buffer crash 2025-06-04 14:32:26 +02:00
target_core_spc.c
target_core_stat.c
target_core_tmr.c
target_core_tpg.c
target_core_transport.c
target_core_ua.c
target_core_ua.h
target_core_user.c genetlink: hold RCU in genlmsg_mcast() 2024-11-08 16:20:50 +01:00
target_core_xcopy.c
target_core_xcopy.h