cb->disable_intr may not be set yet when myrb_cleanup is called.
check before using this function pointer.

[    1.410913] BUG: kernel NULL pointer dereference, address: 0000000000000000
[    1.411273] #PF: supervisor instruction fetch in kernel mode
[    1.411566] #PF: error_code(0x0010) - not-present page
[    1.413138] RIP: 0010:0x0
[    1.417711]  myrb_cleanup+0x13f/0x1b0 [myrb]
[    1.417939]  myrb_probe.cold+0xc6/0x6fc [myrb]

Signed-off-by: Tong Zhang <[email protected]>
---
 drivers/scsi/myrb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index 3d8e91c07dc7..ee33d97fb92c 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -1240,7 +1240,8 @@ static void myrb_cleanup(struct myrb_hba *cb)
        myrb_unmap(cb);
 
        if (cb->mmio_base) {
-               cb->disable_intr(cb->io_base);
+               if (cb->disable_intr)
+                       cb->disable_intr(cb->io_base);
                iounmap(cb->mmio_base);
        }
        if (cb->irq)
-- 
2.25.1

Reply via email to