Skip to content

Commit 4db0959

Browse files
lztomartinkpetersen
authored andcommitted
scsi: myrs: Fix crash in error case
In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fails with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and crash the kernel. [ 1.105606] myrs 0000:00:03.0: Unknown Initialization Error 5A [ 1.105872] myrs 0000:00:03.0: Failed to initialize Controller [ 1.106082] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 1.110774] Call Trace: [ 1.110950] myrs_cleanup+0xe4/0x150 [myrs] [ 1.111135] myrs_probe.cold+0x91/0x56a [myrs] [ 1.111302] ? DAC960_GEM_intr_handler+0x1f0/0x1f0 [myrs] [ 1.111500] local_pci_probe+0x48/0x90 Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Tong Zhang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent efd7bb1 commit 4db0959

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/myrs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs)
22672267
myrs_unmap(cs);
22682268

22692269
if (cs->mmio_base) {
2270-
cs->disable_intr(cs);
2270+
if (cs->disable_intr)
2271+
cs->disable_intr(cs);
22712272
iounmap(cs->mmio_base);
22722273
cs->mmio_base = NULL;
22732274
}

0 commit comments

Comments
 (0)