* [PATCH] isdn: hfcpci: fix potential NULL pointer dereference
@ 2019-03-09 5:46 Kangjie Lu
2019-03-10 17:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-09 5:46 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Karsten Keil, David S. Miller, Jia-Ju Bai,
Gustavo A. R. Silva, netdev, linux-kernel
In case ioremap fails, the fix reports an error and returns.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/isdn/hardware/mISDN/hfcpci.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index ebb3fa2e1d00..b400d6528a56 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -2036,6 +2036,11 @@ setup_hw(struct hfc_pci *hc)
"HFC-PCI: defined at mem %#lx fifo %#lx(%#lx) IRQ %d HZ %d\n",
(u_long) hc->hw.pci_io, (u_long) hc->hw.fifos,
(u_long) hc->hw.dmahandle, hc->irq, HZ);
+ if (unlikely(!hc->hw.pci_io)) {
+ printk(KERN_WARNING
+ "HFC-PCI: ioremap failed!\n");
+ return 1;
+ }
/* enable memory mapped ports, disable busmaster */
pci_write_config_word(hc->pdev, PCI_COMMAND, PCI_ENA_MEMIO);
hc->hw.int_m2 = 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] isdn: hfcpci: fix potential NULL pointer dereference
2019-03-09 5:46 [PATCH] isdn: hfcpci: fix potential NULL pointer dereference Kangjie Lu
@ 2019-03-10 17:56 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-10 17:56 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, isdn, baijiaju1990, gustavo, netdev, linux-kernel
From: Kangjie Lu <kjlu@umn.edu>
Date: Fri, 8 Mar 2019 23:46:04 -0600
> In case ioremap fails, the fix reports an error and returns.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
First, you shouldn't print the information log message if this fails.
Second you are leaking hc->hw.fifos, you have to clean up any resources
allocated up until this point if you fail.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-10 17:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 5:46 [PATCH] isdn: hfcpci: fix potential NULL pointer dereference Kangjie Lu
2019-03-10 17:56 ` David Miller
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).