On 15.12.2019 20.03, Sasha Levin wrote:
On Sun, Dec 15, 2019 at 10:27:46AM +0100, gregkh@linuxfoundation.org wrote:
The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to stable@vger.kernel.org.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From bd82873f23c9a6ad834348f8b83f3b6a5bca2c65 Mon Sep 17 00:00:00 2001 From: Mathias Nyman mathias.nyman@linux.intel.com Date: Wed, 11 Dec 2019 16:20:07 +0200 Subject: [PATCH] xhci: make sure interrupts are restored to correct state
spin_unlock_irqrestore() might be called with stale flags after reading port status, possibly restoring interrupts to a incorrect state.
If a usb2 port just finished resuming while the port status is read the spin lock will be temporary released and re-acquired in a separate function. The flags parameter is passed as value instead of a pointer, not updating flags properly before the final spin_unlock_irqrestore() is called.
Cc: stable@vger.kernel.org # v3.12+ Fixes: 8b3d45705e54 ("usb: Fix xHCI host issues on remote wakeup.") Signed-off-by: Mathias Nyman mathias.nyman@linux.intel.com Link: https://lore.kernel.org/r/20191211142007.8847-7-mathias.nyman@linux.intel.co... Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
There were quite a few code movements around this:
e67ebf1b3815 ("xhci: move usb2 get port status link resume handling to its own function") 5f78a54f8d31 ("xhci: move usb3 speficic bits to own function in get_port_status call") 70e9b53dfedc ("xhci: move usb2 speficic bits to own function in get_port_status call")
I've fixed up the original patch to work around that and queued for 4.19
- 4.4.
Thank you for backporting, there was a lot of code shuffled around in this area.
-Mathias