* [PATCH v1] scsi: myrs: fix crash on error case
@ 2022-01-23 22:57 Tong Zhang
2022-01-24 6:49 ` Hannes Reinecke
2022-01-25 5:41 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Tong Zhang @ 2022-01-23 22:57 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
Cc: Tong Zhang
In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fail
with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and
crash 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
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
---
drivers/scsi/myrs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 253ceca54a84..7eb8c39da366 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs)
myrs_unmap(cs);
if (cs->mmio_base) {
- cs->disable_intr(cs);
+ if (cs->disable_intr)
+ cs->disable_intr(cs);
iounmap(cs->mmio_base);
cs->mmio_base = NULL;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] scsi: myrs: fix crash on error case
2022-01-23 22:57 [PATCH v1] scsi: myrs: fix crash on error case Tong Zhang
@ 2022-01-24 6:49 ` Hannes Reinecke
2022-01-25 5:41 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2022-01-24 6:49 UTC (permalink / raw)
To: Tong Zhang, Hannes Reinecke, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel
On 1/23/22 23:57, Tong Zhang wrote:
> In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fail
> with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and
> crash 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
>
> Signed-off-by: Tong Zhang <ztong0001@gmail.com>
> ---
> drivers/scsi/myrs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
> index 253ceca54a84..7eb8c39da366 100644
> --- a/drivers/scsi/myrs.c
> +++ b/drivers/scsi/myrs.c
> @@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs)
> myrs_unmap(cs);
>
> if (cs->mmio_base) {
> - cs->disable_intr(cs);
> + if (cs->disable_intr)
> + cs->disable_intr(cs);
> iounmap(cs->mmio_base);
> cs->mmio_base = NULL;
> }
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] scsi: myrs: fix crash on error case
2022-01-23 22:57 [PATCH v1] scsi: myrs: fix crash on error case Tong Zhang
2022-01-24 6:49 ` Hannes Reinecke
@ 2022-01-25 5:41 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-01-25 5:41 UTC (permalink / raw)
To: Tong Zhang, James E.J. Bottomley, linux-scsi, Hannes Reinecke,
linux-kernel
Cc: Martin K . Petersen
On Sun, 23 Jan 2022 14:57:17 -0800, Tong Zhang wrote:
> In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fail
> with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and
> crash 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
>
> [...]
Applied to 5.17/scsi-fixes, thanks!
[1/1] scsi: myrs: fix crash on error case
https://git.kernel.org/mkp/scsi/c/4db09593af0b
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-25 5:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 22:57 [PATCH v1] scsi: myrs: fix crash on error case Tong Zhang
2022-01-24 6:49 ` Hannes Reinecke
2022-01-25 5:41 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®