This is a note to let you know that I've just added the patch titled USB: chipidea: fix interrupt deadlock to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-chipidea-fix-interrupt-deadlock.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9aaa81c3366e8393a62374e3a1c67c69edc07b8a Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan@xxxxxxxxxx> Date: Thu, 21 Oct 2021 10:34:47 +0200 Subject: USB: chipidea: fix interrupt deadlock From: Johan Hovold <johan@xxxxxxxxxx> commit 9aaa81c3366e8393a62374e3a1c67c69edc07b8a upstream. Chipidea core was calling the interrupt handler from non-IRQ context with interrupts enabled, something which can lead to a deadlock if there's an actual interrupt trying to take a lock that's already held (e.g. the controller lock in udc_irq()). Add a wrapper that can be used to fake interrupts instead of calling the handler directly. Fixes: 3ecb3e09b042 ("usb: chipidea: Use extcon framework for VBUS and ID detect") Fixes: 876d4e1e8298 ("usb: chipidea: core: add wakeup support for extcon") Cc: Peter Chen <peter.chen@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # 4.4 Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Link: https://lore.kernel.org/r/20211021083447.20078-1-johan@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/chipidea/core.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -516,7 +516,7 @@ int hw_device_reset(struct ci_hdrc *ci) return 0; } -static irqreturn_t ci_irq(int irq, void *data) +static irqreturn_t ci_irq_handler(int irq, void *data) { struct ci_hdrc *ci = data; irqreturn_t ret = IRQ_NONE; @@ -569,6 +569,15 @@ static irqreturn_t ci_irq(int irq, void return ret; } +static void ci_irq(struct ci_hdrc *ci) +{ + unsigned long flags; + + local_irq_save(flags); + ci_irq_handler(ci->irq, ci); + local_irq_restore(flags); +} + static int ci_vbus_notifier(struct notifier_block *nb, unsigned long event, void *ptr) { @@ -582,7 +591,7 @@ static int ci_vbus_notifier(struct notif vbus->changed = true; - ci_irq(ci->irq, ci); + ci_irq(ci); return NOTIFY_DONE; } @@ -599,7 +608,7 @@ static int ci_id_notifier(struct notifie id->changed = true; - ci_irq(ci->irq, ci); + ci_irq(ci); return NOTIFY_DONE; } @@ -1011,7 +1020,7 @@ static int ci_hdrc_probe(struct platform } platform_set_drvdata(pdev, ci); - ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, + ret = devm_request_irq(dev, ci->irq, ci_irq_handler, IRQF_SHARED, ci->platdata->name, ci); if (ret) goto stop; @@ -1126,11 +1135,11 @@ static void ci_extcon_wakeup_int(struct if (!IS_ERR(cable_id->edev) && ci->is_otg && (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS)) - ci_irq(ci->irq, ci); + ci_irq(ci); if (!IS_ERR(cable_vbus->edev) && ci->is_otg && (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS)) - ci_irq(ci->irq, ci); + ci_irq(ci); } static int ci_controller_resume(struct device *dev) Patches currently in stable-queue which might be from johan@xxxxxxxxxx are queue-4.9/alsa-ua101-fix-division-by-zero-at-probe.patch queue-4.9/ath6kl-fix-control-message-timeout.patch queue-4.9/usb-iowarrior-fix-control-message-timeouts.patch queue-4.9/usb-chipidea-fix-interrupt-deadlock.patch queue-4.9/alsa-line6-fix-control-and-interrupt-message-timeouts.patch queue-4.9/mwifiex-fix-division-by-zero-in-fw-download-path.patch queue-4.9/usb-serial-keyspan-fix-memleak-on-probe-errors.patch queue-4.9/rtl8187-fix-control-message-timeouts.patch queue-4.9/ath6kl-fix-division-by-zero-in-send-path.patch queue-4.9/alsa-6fire-fix-control-and-bulk-message-timeouts.patch