linux/drivers/scsi/lpfc
Justin Tee f910374870 scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow
[ Upstream commit c6087b82a9 ]

A static code analysis tool flagged the possibility of buffer overflow when
using copy_from_user() for a debugfs entry.

Currently, it is possible that copy_from_user() copies more bytes than what
would fit in the mybuf char array.  Add a min() restriction check between
sizeof(mybuf) - 1 and nbytes passed from the userspace buffer to protect
against buffer overflow.

Link: https://lore.kernel.org/r/20230301231626.9621-2-justintee8345@gmail.com
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-24 17:36:44 +01:00
..
lpfc_attr.c scsi: lpfc: Fix pt2pt NVMe PRLI reject LOGO loop 2022-02-23 12:03:20 +01:00
lpfc_attr.h
lpfc_bsg.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_bsg.h
lpfc_compat.h
lpfc_crtn.h scsi: lpfc: Rework MIB Rx Monitor debug info logic 2022-11-10 18:15:24 +01:00
lpfc_ct.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_debugfs.c scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow 2023-05-24 17:36:44 +01:00
lpfc_debugfs.h scsi: lpfc: Rework MIB Rx Monitor debug info logic 2022-11-10 18:15:24 +01:00
lpfc_disc.h
lpfc_els.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_hbadisc.c scsi: lpfc: Fix EEH support for NVMe I/O 2022-08-17 14:24:20 +02:00
lpfc_hw4.h Revert "scsi: lpfc: SLI path split: Refactor fast and slow paths to native SLI4" 2022-11-03 23:59:14 +09:00
lpfc_hw.h
lpfc_ids.h
lpfc_init.c scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup() 2023-05-11 23:00:28 +09:00
lpfc_logmsg.h scsi: lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg() 2022-06-09 10:22:32 +02:00
lpfc_mbox.c
lpfc_mem.c scsi: lpfc: Rework MIB Rx Monitor debug info logic 2022-11-10 18:15:24 +01:00
lpfc_nl.h
lpfc_nportdisc.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_nvme.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_nvme.h Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_nvmet.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_scsi.c Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_scsi.h
lpfc_sli4.h scsi: lpfc: Fix EEH support for NVMe I/O 2022-08-17 14:24:20 +02:00
lpfc_sli.c scsi: lpfc: Avoid usage of list iterator variable after loop 2023-03-30 12:47:54 +02:00
lpfc_sli.h Revert "scsi: lpfc: SLI path split: Refactor lpfc_iocbq" 2022-11-03 23:59:14 +09:00
lpfc_version.h
lpfc_vport.c
lpfc_vport.h
lpfc.h scsi: lpfc: Rework MIB Rx Monitor debug info logic 2022-11-10 18:15:24 +01:00
Makefile