[U-Boot] [PATCH] usb: ehci-hcd: Fix crash when no ops are provided to ehci_register()

This commit fixes crash on BananaPi (and possibly others) casued by 3f9f8a5b83f8aec40c9f4ee496046a695e333c45.
Crash reason: When no ops were passed to ehci_register(), USB host driver caused NULL pointer dereference.
Signed-off-by: Mateusz Kulikowski mateusz.kulikowski@gmail.com ---
drivers/usb/host/ehci-hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 598f444..fa5d584 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1615,8 +1615,8 @@ int ehci_register(struct udevice *dev, struct ehci_hccr *hccr, if (ret) goto err;
- if (ops->init_after_reset) { - ret = ops->init_after_reset(ctrl); + if (ctrl->ops.init_after_reset) { + ret = ctrl->ops.init_after_reset(ctrl); if (ret) goto err; }

This commit fixes crash on BananaPi (and possibly others) casued by 3f9f8a5b83f8aec40c9f4ee496046a695e333c45.
Crash reason: When no ops were passed to ehci_register(), USB host driver caused NULL pointer dereference.
Signed-off-by: Mateusz Kulikowski mateusz.kulikowski@gmail.com
Confirmed working for Banana Pi, both on top of 3f9f8a5 and when applied to current master (563d8d9).
Tested-by: Bernhard Nortmann bernhard.nortmann@web.de
Regards, B. Nortmann

On 04/03/2016 01:38 PM, Mateusz Kulikowski wrote:
This commit fixes crash on BananaPi (and possibly others) casued by 3f9f8a5b83f8aec40c9f4ee496046a695e333c45.
Crash reason: When no ops were passed to ehci_register(), USB host driver caused NULL pointer dereference.
Signed-off-by: Mateusz Kulikowski mateusz.kulikowski@gmail.com
Applied, thanks!
Best regards, Marek Vasut
participants (3)
-
Bernhard Nortmann
-
Marek Vasut
-
Mateusz Kulikowski