mpt3sas:Fix kernel panic during drive powercycle test
Subsystems (2)
Sreekanth Reddy
maintainerPATCH 1/1 mpt3sas:Fix kernel panic during drive powercycle test
While looping over shost's sdev list it is possible that one of the drive is getting removed and it's sas_target object is freed but it's sdev object is still intact with the sdev list. So, kernel panic occurred while driver trying to access the sas_address field of sas_target object without checking the sas_target object for NULL pointer.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 -1
@@ -3869,7 +3869,7 @@ _scsih_ublock_io_device(struct MPT3SAS_ADAPTER *ioc,shost_for_each_device (sdev, ioc->shost) { sas_device_priv_data = sdev->hostdata; -if (!sas_device_priv_data) +if (!sas_device_priv_data || !sas_device_priv_data->sas_target)continue ;if (sas_device_priv_data->sas_target->sas_address != sas_address)
Signature · 1 line
2.27.0
Martin K. Petersen
AppliedQuoted 8 lines · Sreekanth Reddy
While looping over shost's sdev list it is possible that one of the drive is getting removed and it's
sas_targetobject is freed but it's sdev object is still intact with the sdev list. So, kernel panic occurred while driver trying to access thesas_addressfield ofsas_targetobject without checking thesas_targetobject for NULL pointer.[...]
Applied to 5.16/scsi-fixes, thanks!
[1/1] mpt3sas:Fix kernel panic during drive powercycle test
https://git.kernel.org/mkp/scsi/c/0ee4ba13e09c
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering