* [PATCH 0/2] scsi: myrb: fix null-ptr-dereference issues
@ 2021-03-22 0:29 Tong Zhang
2021-03-22 0:29 ` [PATCH 1/2] scsi: myrb: fix null-ptr-dereference in myrb_cleanup Tong Zhang
2021-03-22 0:29 ` [PATCH 2/2] scsi: myrb: fix null-ptr-dereference in myrb_probe Tong Zhang
0 siblings, 2 replies; 3+ messages in thread
From: Tong Zhang @ 2021-03-22 0:29 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
Cc: ztong0001
This series fixes two null-ptr-dereference issues in the myrb driver.
Both are caused by uninitialized variables.
Tong Zhang (2):
scsi: myrb: fix null-ptr-dereference in myrb_cleanup
scsi: myrb: fix null-ptr-dereference in myrb_probe
drivers/scsi/myrb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] scsi: myrb: fix null-ptr-dereference in myrb_cleanup
2021-03-22 0:29 [PATCH 0/2] scsi: myrb: fix null-ptr-dereference issues Tong Zhang
@ 2021-03-22 0:29 ` Tong Zhang
2021-03-22 0:29 ` [PATCH 2/2] scsi: myrb: fix null-ptr-dereference in myrb_probe Tong Zhang
1 sibling, 0 replies; 3+ messages in thread
From: Tong Zhang @ 2021-03-22 0:29 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
Cc: ztong0001
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] scsi: myrb: fix null-ptr-dereference in myrb_probe
2021-03-22 0:29 [PATCH 0/2] scsi: myrb: fix null-ptr-dereference issues Tong Zhang
2021-03-22 0:29 ` [PATCH 1/2] scsi: myrb: fix null-ptr-dereference in myrb_cleanup Tong Zhang
@ 2021-03-22 0:29 ` Tong Zhang
1 sibling, 0 replies; 3+ messages in thread
From: Tong Zhang @ 2021-03-22 0:29 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
Cc: ztong0001
cb->host should be initialized and set before it is used by the
following probe logic and the interrupt handler etc.
[ 5.073493] BUG: kernel NULL pointer dereference, address: 00000000000002cc
[ 5.075907] RIP: 0010:kobject_put+0x25/0x120
[ 5.081572] Call Trace:
[ 5.081720] myrb_probe.cold+0x22/0xabc [myrb]
[ 5.083510] local_pci_probe+0x6f/0xb0
Fixes: 081ff398c56c ("scsi: myrb: Add Mylex RAID controller (block interface)")
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
---
drivers/scsi/myrb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index ee33d97fb92c..7de49b869128 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -3512,6 +3512,7 @@ static struct myrb_hba *myrb_detect(struct pci_dev *pdev,
shost->max_cmd_len = 12;
shost->max_lun = 256;
cb = shost_priv(shost);
+ cb->host = shost;
mutex_init(&cb->dcmd_mutex);
mutex_init(&cb->dma_mutex);
cb->pdev = pdev;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-22 0:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 0:29 [PATCH 0/2] scsi: myrb: fix null-ptr-dereference issues Tong Zhang
2021-03-22 0:29 ` [PATCH 1/2] scsi: myrb: fix null-ptr-dereference in myrb_cleanup Tong Zhang
2021-03-22 0:29 ` [PATCH 2/2] scsi: myrb: fix null-ptr-dereference in myrb_probe Tong Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).