diff options
author | David Dueck <davidcdueck@googlemail.com> | 2015-02-08 16:29:30 +0100 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2015-04-16 20:11:39 -0400 |
commit | de4b9c41c2518137d51b765b270317dd0f16367a (patch) | |
tree | e91c749e4b0c20ab1986ea627107366f4f7cc2f5 /drivers | |
parent | 07088f9c1e226491362ab4a96363fb2ac73f8a48 (diff) |
usb: phy: am335x-control: check return value of bus_find_device
[ Upstream commit d0f347d62814ec0f599a05c61c5619d5e999e4ae ]
This fixes a potential null pointer dereference.
Cc: <stable@vger.kernel.org> # v3.16+
Fixes: d4332013919a ("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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/phy/phy-am335x-control.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index 35b6083b7999..d5eca7b9c555 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -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; |