Skip to content

Commit 0ee4ba1

Browse files
sreekanthbrcmmartinkpetersen
authored andcommitted
scsi: mpt3sas: Fix kernel panic during drive powercycle test
While looping over shost's sdev list it is possible that one of the drives is getting removed and its sas_target object is freed but its sdev object remains intact. Consequently, a kernel panic can occur while the driver is trying to access the sas_address field of sas_target object without also checking the sas_target object for NULL. Link: https://lore.kernel.org/r/[email protected] Fixes: f92363d ("[SCSI] mpt3sas: add new driver supporting 12GB SAS") Signed-off-by: Sreekanth Reddy <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent cc03fac commit 0ee4ba1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3869,7 +3869,7 @@ _scsih_ublock_io_device(struct MPT3SAS_ADAPTER *ioc,
38693869

38703870
shost_for_each_device(sdev, ioc->shost) {
38713871
sas_device_priv_data = sdev->hostdata;
3872-
if (!sas_device_priv_data)
3872+
if (!sas_device_priv_data || !sas_device_priv_data->sas_target)
38733873
continue;
38743874
if (sas_device_priv_data->sas_target->sas_address
38753875
!= sas_address)

0 commit comments

Comments
 (0)