Commit 91a0c0c
scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup()
When if_type equals zero and pci_resource_start(pdev, PCI_64BIT_BAR4)
returns false, drbl_regs_memmap_p is not remapped. This passes a NULL
pointer to iounmap(), which can trigger a WARN() on certain arches.
When if_type equals six and pci_resource_start(pdev, PCI_64BIT_BAR4)
returns true, drbl_regs_memmap_p may has been remapped and
ctrl_regs_memmap_p is not remapped. This is a resource leak and passes a
NULL pointer to iounmap().
To fix these issues, we need to add null checks before iounmap(), and
change some goto labels.
Fixes: 1351e69 ("scsi: lpfc: Add push-to-adapter support to sli4")
Signed-off-by: Shuchang Li <lishuchang@hust.edu.cn>
Link: https://lore.kernel.org/r/20230404072133.1022-1-lishuchang@hust.edu.cn
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 85140ba commit 91a0c0c
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12024 | 12024 | | |
12025 | 12025 | | |
12026 | 12026 | | |
12027 | | - | |
| 12027 | + | |
12028 | 12028 | | |
12029 | 12029 | | |
12030 | 12030 | | |
| |||
12042 | 12042 | | |
12043 | 12043 | | |
12044 | 12044 | | |
12045 | | - | |
| 12045 | + | |
12046 | 12046 | | |
12047 | 12047 | | |
12048 | 12048 | | |
| |||
12067 | 12067 | | |
12068 | 12068 | | |
12069 | 12069 | | |
12070 | | - | |
| 12070 | + | |
| 12071 | + | |
12071 | 12072 | | |
12072 | | - | |
| 12073 | + | |
| 12074 | + | |
12073 | 12075 | | |
12074 | 12076 | | |
12075 | 12077 | | |
| |||
0 commit comments