Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: lpfc: Avoid another null dereference in lpfc_sli4_hba_unset()

Commit cdb42becdd40 ("scsi: lpfc: Replace io_channels for nvme and fcp with
general hdw_queues per cpu") has introduced static checker warnings for
potential null dereferences in 'lpfc_sli4_hba_unset()' and commit 1ffdd2c0440d
("scsi: lpfc: resolve static checker warning in lpfc_sli4_hba_unset") has
tried to fix it. However, yet another potential null dereference is
remaining. This commit fixes it.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Link: https://lore.kernel.org/r/20200623084122.30633-1-sjpark@amazon.com
Fixes: 1ffdd2c0440d ("scsi: lpfc: resolve static checker warning inlpfc_sli4_hba_unset")
Fixes: cdb42becdd40 ("scsi: lpfc: Replace io_channels for nvme and fcp with general hdw_queues per cpu")
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: SeongJae Park <sjpark@amazon.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

SeongJae Park and committed by
Martin K. Petersen
46da547e aad4b4d1

+2 -1
+2 -1
drivers/scsi/lpfc/lpfc_init.c
··· 11878 11878 lpfc_sli4_xri_exchange_busy_wait(phba); 11879 11879 11880 11880 /* per-phba callback de-registration for hotplug event */ 11881 - lpfc_cpuhp_remove(phba); 11881 + if (phba->pport) 11882 + lpfc_cpuhp_remove(phba); 11882 11883 11883 11884 /* Disable PCI subsystem interrupt */ 11884 11885 lpfc_sli4_disable_intr(phba);