scsi: mpi3mr: Driver unload crashes host when enhanced logging is enabled
authorRanjan Kumar <ranjan.kumar@broadcom.com>
Tue, 28 Feb 2023 14:08:31 +0000 (06:08 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 6 Mar 2023 23:33:12 +0000 (18:33 -0500)
Prevent driver from trying to dereference a NULL pointer in a debug print
while removing a device during driver unload.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230228140835.4075-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpi3mr/mpi3mr_transport.c

index 3b61815979dabe5c9a1113a410f34e3333905229..b795a325534d3003dd5b95c082c60d6a9c8ffd9a 100644 (file)
@@ -1552,7 +1552,8 @@ static void mpi3mr_sas_port_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,
 
        list_for_each_entry_safe(mr_sas_phy, next_phy,
            &mr_sas_port->phy_list, port_siblings) {
-               if ((mrioc->logging_level & MPI3_DEBUG_TRANSPORT_INFO))
+               if ((!mrioc->stop_drv_processing) &&
+                   (mrioc->logging_level & MPI3_DEBUG_TRANSPORT_INFO))
                        dev_info(&mr_sas_port->port->dev,
                            "remove: sas_address(0x%016llx), phy(%d)\n",
                            (unsigned long long)