linux/drivers/scsi/mpt3sas
Wenchao Hao d3c57724f1 scsi: mpt3sas: Fix NULL pointer access in mpt3sas_transport_port_add()
Port is allocated by sas_port_alloc_num() and rphy is allocated by either
sas_end_device_alloc() or sas_expander_alloc(), all of which may return
NULL. So we need to check the rphy to avoid possible NULL pointer access.

If sas_rphy_add() returned with failure, rphy is set to NULL. We would
access the rphy in the following lines which would also result NULL pointer
access.

Fixes: 78316e9dfc ("scsi: mpt3sas: Fix possible resource leaks in mpt3sas_transport_port_add()")
Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
Link: https://lore.kernel.org/r/20230225100135.2109330-1-haowenchao2@huawei.com
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-03-07 21:02:09 -05:00
..
mpi scsi: mpt3sas: Add support for ATTO ExpressSAS H12xx GT devices 2022-08-31 23:39:57 -04:00
Kconfig scsi: mpt3sas: Fix spelling mistake in Kconfig "compatiblity" -> "compatibility" 2021-01-05 23:25:07 -05:00
Makefile scsi: mpt3sas: Capture IOC data for debugging purposes 2020-05-07 22:24:27 -04:00
mpt3sas_base.c SCSI misc on 20230222 2023-02-22 13:41:41 -08:00
mpt3sas_base.h scsi: mpt3sas: Update driver version to 43.100.00.00 2022-09-01 00:15:47 -04:00
mpt3sas_config.c scsi: mpt3sas: Add support for ATTO ExpressSAS H12xx GT devices 2022-08-31 23:39:57 -04:00
mpt3sas_ctl.c scsi: mpt3sas: Demote log level for trace buffer allocation to info 2023-01-18 18:39:15 -05:00
mpt3sas_ctl.h scsi: mpt3sas: Fix out-of-bounds warnings in _ctl_addnl_diag_query 2021-04-13 00:31:05 -04:00
mpt3sas_debug.h
mpt3sas_debugfs.c scsi: mpt3sas: Remove unused including <linux/version.h> 2020-05-11 23:09:21 -04:00
mpt3sas_scsih.c SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
mpt3sas_transport.c scsi: mpt3sas: Fix NULL pointer access in mpt3sas_transport_port_add() 2023-03-07 21:02:09 -05:00
mpt3sas_trigger_diag.c scsi: mpt3sas: Additional diagnostic buffer query interface 2021-02-08 22:02:07 -05:00
mpt3sas_trigger_diag.h scsi: mpt3sas: Fix spelling mistake 2020-06-15 23:28:46 -04:00
mpt3sas_trigger_pages.h scsi: mpt3sas: Add persistent trigger pages support 2020-12-09 11:34:18 -05:00
mpt3sas_warpdrive.c