Commit 086ac918 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

usb: chipidea: host: fix NULL ptr dereference during shutdown

commit 991d5add upstream.

After commit b09b5224 ("usb: chipidea: implement platform shutdown
callback") and commit 43a40457 ("usb: chipidea: host: set host to
be null after hcd is freed") a NULL pointer dereference is caused
on i.MX23 during shutdown. So ensure that role is set to CI_ROLE_END and
we finish interrupt handling before the hcd is deallocated. This avoids
the NULL pointer dereference.
Suggested-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Fixes: b09b5224 ("usb: chipidea: implement platform shutdown callback")
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07bae478
...@@ -185,6 +185,8 @@ static void host_stop(struct ci_hdrc *ci) ...@@ -185,6 +185,8 @@ static void host_stop(struct ci_hdrc *ci)
if (hcd) { if (hcd) {
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
ci->role = CI_ROLE_END;
synchronize_irq(ci->irq);
usb_put_hcd(hcd); usb_put_hcd(hcd);
if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) &&
(ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON)) (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment