]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: myrs: Fix crash in error case
authorTong Zhang <ztong0001@gmail.com>
Sun, 23 Jan 2022 22:57:17 +0000 (14:57 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 25 Jan 2022 05:09:41 +0000 (00:09 -0500)
commit186148ed0d470177accf49229978c1a133253acd
tree6fdd50032e248bd82d83d74e9c6fb20225d17d0d
parent3a7eaba937c4da3d1f3f9b973ef8471c801226e3
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/20220123225717.1069538-1-ztong0001@gmail.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/myrs.c