lkml.org 
[lkml]   [2021]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] scsi: myrb: fix null-ptr-dereference in myrb_cleanup
Date
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 <ztong0001@gmail.com>
---
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
\
 
 \ /
  Last update: 2021-03-22 01:31    [W:0.023 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site