Commit 624c55c7 authored by Konstantin Shelekhin's avatar Konstantin Shelekhin Committed by sanglipeng
Browse files

scsi: target: iscsi: Fix buffer overflow in lio_target_nacl_info_show()

stable inclusion
from stable-v5.10.197
commit bbe3ff47bf09db8956bc2eeb49d2d514d256ad2a
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96Q8P

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=bbe3ff47bf09db8956bc2eeb49d2d514d256ad2a



--------------------------------

[ Upstream commit 801f287c ]

The function lio_target_nacl_info_show() uses sprintf() in a loop to print
details for every iSCSI connection in a session without checking for the
buffer length. With enough iSCSI connections it's possible to overflow the
buffer provided by configfs and corrupt the memory.

This patch replaces sprintf() with sysfs_emit_at() that checks for buffer
boundries.

Signed-off-by: default avatarKonstantin Shelekhin <k.shelekhin@yadro.com>
Link: https://lore.kernel.org/r/20230722152657.168859-2-k.shelekhin@yadro.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 0678d4d7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment