Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de4b9c41 authored by David Dueck's avatar David Dueck Committed by Sasha Levin
Browse files

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: d4332013 ("driver core: dev_get_drvdata: Don't check for NULL dev")
Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarDavid Dueck <davidcdueck@googlemail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 07088f9c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;