usb: host: ohci-tmio: check return value after calling platform_get_resource()

Started by Yang Yingliang on Oct 11, 2021

Subsystems (3)

Maintainers (3)

DORMANTno replies LANDED · 1 review, 1 by a maintainer

Status: Landed in mainline as 9eff2b2e59fd on 2021-10-13.

1 review trailer (1 from subsystem maintainers).

open the first message on its own page

Message details and related content
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: Yang Yingliang <redacted>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
v2:
  combine the new checkings with cell checking
---
 drivers/usb/host/ohci-tmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 08ec2ab0d95a..3f3d62dc0674 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -199,7 +199,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
 	if (usb_disabled())
 		return -ENODEV;
 
-	if (!cell)
+	if (!cell || !regs || !config || !sram)
 		return -EINVAL;
 
 	if (irq < 0)
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help