Skip to content

Commit 991d5ad

Browse files
Stefan WahrenPeter Chen
authored andcommitted
usb: chipidea: host: fix NULL ptr dereference during shutdown
After commit b09b522 ("usb: chipidea: implement platform shutdown callback") and commit 43a4045 ("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: b09b522 ("usb: chipidea: implement platform shutdown callback") Signed-off-by: Peter Chen <peter.chen@nxp.com>
1 parent b760323 commit 991d5ad

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/usb/chipidea/host.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ static void host_stop(struct ci_hdrc *ci)
188188

189189
if (hcd) {
190190
usb_remove_hcd(hcd);
191+
ci->role = CI_ROLE_END;
192+
synchronize_irq(ci->irq);
191193
usb_put_hcd(hcd);
192194
if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) &&
193195
(ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON))

0 commit comments

Comments
 (0)