linux/drivers/scsi/bfa
Bui Quang Minh 1708e3cf24 scsi: bfa: Ensure the copied buf is NUL terminated
[ Upstream commit 13d0cecb46 ]

Currently, we allocate a nbytes-sized kernel buffer and copy nbytes from
userspace to that buffer. Later, we use sscanf on this buffer but we don't
ensure that the string is terminated inside the buffer, this can lead to
OOB read when using sscanf. Fix this issue by using memdup_user_nul instead
of memdup_user.

Fixes: 9f30b67475 ("bfa: replace 2 kzalloc/copy_from_user by memdup_user")
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
Link: https://lore.kernel.org/r/20240424-fix-oob-read-v2-3-f1f1b53a10f4@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-16 13:39:24 +02:00
..
bfa_core.c
bfa_cs.h
bfa_defs_fcs.h
bfa_defs_svc.h
bfa_defs.h
bfa_fc.h
bfa_fcbuild.c
bfa_fcbuild.h
bfa_fcpim.c
bfa_fcpim.h
bfa_fcs_fcpim.c
bfa_fcs_lport.c
bfa_fcs_rport.c
bfa_fcs.c
bfa_fcs.h
bfa_hw_cb.c
bfa_hw_ct.c
bfa_ioc_cb.c
bfa_ioc_ct.c
bfa_ioc.c
bfa_ioc.h
bfa_modules.h
bfa_plog.h
bfa_port.c
bfa_port.h
bfa_svc.c
bfa_svc.h
bfa.h
bfad_attr.c
bfad_bsg.c
bfad_bsg.h
bfad_debugfs.c
bfad_drv.h
bfad_im.c
bfad_im.h
bfad.c
bfi_ms.h
bfi_reg.h
bfi.h
Makefile