Skip to content

Commit

Permalink
usb: phy: am335x-control: check return value of bus_find_device
Browse files Browse the repository at this point in the history
This fixes a potential null pointer dereference.

Cc: <stable@vger.kernel.org> # v3.16+
Fixes: d433201 ("driver core: dev_get_drvdata: Don't check for NULL dev")
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David Dueck <davidcdueck@googlemail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
David Dueck authored and Felipe Balbi committed Mar 10, 2015
1 parent 509d612 commit d0f347d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/phy/phy-am335x-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev)
return NULL;

dev = bus_find_device(&platform_bus_type, NULL, node, match);
if (!dev)
return NULL;

ctrl_usb = dev_get_drvdata(dev);
if (!ctrl_usb)
return NULL;
Expand Down

0 comments on commit d0f347d

Please sign in to comment.