From: Varka Bhadram <[email protected]>
This series fixes for NULL pointer dereference on resource.
Series based on usb-next of [1]
changes:
Up to v3, combined series for fixes and cleanups for resource
check. For v4 seperated as two series on for fixes another for cleanups.
[1]: https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git
Varka Bhadram (2):
host: uhci-platform: fix NULL pointer dereference on resource
host: ehci-sead3: fix NULL pointer dereference on resource
drivers/usb/host/ehci-sead3.c | 5 ++---
drivers/usb/host/uhci-platform.c | 6 +++---
2 files changed, 5 insertions(+), 6 deletions(-)
--
1.7.9.5
From: Varka Bhadram <[email protected]>
Fix in accessing NULL if resource didn't get.
Signed-off-by: Varka Bhadram <[email protected]>
Acked-by: Alan Stern <[email protected]>
---
drivers/usb/host/uhci-platform.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index b987f1d..cf8f460 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -86,14 +86,14 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- hcd->rsrc_start = res->start;
- hcd->rsrc_len = resource_size(res);
-
hcd->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(hcd->regs)) {
ret = PTR_ERR(hcd->regs);
goto err_rmr;
}
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = resource_size(res);
+
uhci = hcd_to_uhci(hcd);
uhci->regs = hcd->regs;
--
1.7.9.5
From: Varka Bhadram <[email protected]>
Fix on accessing NULL pointer dereference on get resource failed.
Signed-off-by: Varka Bhadram <[email protected]>
Acked-by: Alan Stern <[email protected]>
---
drivers/usb/host/ehci-sead3.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index cf12676..9b6e8d0 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- hcd->rsrc_start = res->start;
- hcd->rsrc_len = resource_size(res);
-
hcd->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(hcd->regs)) {
ret = PTR_ERR(hcd->regs);
goto err1;
}
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = resource_size(res);
/* Root hub has integrated TT. */
hcd->has_tt = 1;
--
1.7.9.5