diff options
| author | Stefan Wahren <stefan.wahren@i2se.com> | 2016-09-10 08:53:21 -0400 |
|---|---|---|
| committer | Peter Chen <peter.chen@nxp.com> | 2016-10-25 04:14:32 -0400 |
| commit | 991d5add50a5bb6ab8f12f2129f5c7487f6baaf6 (patch) | |
| tree | 00d35bd3a40530c43f17e5ec91223e494770068d /drivers/usb/chipidea | |
| parent | b76032396d7958f006bccf5fb2535beb5526837c (diff) | |
usb: chipidea: host: fix NULL ptr dereference during shutdown
After commit b09b5224fe86 ("usb: chipidea: implement platform shutdown
callback") and commit 43a404577a93 ("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: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: b09b5224fe86 ("usb: chipidea: implement platform shutdown callback")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea')
| -rw-r--r-- | drivers/usb/chipidea/host.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 96ae69502c86..111b0e0b8698 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c | |||
| @@ -188,6 +188,8 @@ static void host_stop(struct ci_hdrc *ci) | |||
| 188 | 188 | ||
| 189 | if (hcd) { | 189 | if (hcd) { |
| 190 | usb_remove_hcd(hcd); | 190 | usb_remove_hcd(hcd); |
| 191 | ci->role = CI_ROLE_END; | ||
| 192 | synchronize_irq(ci->irq); | ||
| 191 | usb_put_hcd(hcd); | 193 | usb_put_hcd(hcd); |
| 192 | if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && | 194 | if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && |
| 193 | (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON)) | 195 | (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON)) |
