Skip to contentSkip to conversation

fixes on resource check

PATCH Superseded [email protected] 1 participant 3 messages Nov 4, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover fixes on resource check

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(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/2 host: uhci-platform: fix NULL pointer dereference on resource

From: Varka Bhadram <[email protected]>

Fix in accessing NULL if resource didn't get.

---
 drivers/usb/host/uhci-platform.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/uhci-platform.c +3 -3
index b987f1d..cf8f460 100644
@@ -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;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v4 2/2 host: ehci-sead3: fix NULL pointer dereference on resource

In reply to [email protected]

From: Varka Bhadram <[email protected]>

Fix on accessing NULL pointer dereference on get resource failed.

---
 drivers/usb/host/ehci-sead3.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-sead3.c +2 -3
index cf12676..9b6e8d0 100644
@@ -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;
Signature · 1 line
1.7.9.5