* FAILED: patch "[PATCH] xhci: make sure interrupts are restored to correct state" failed to apply to 4.19-stable tree
@ 2019-12-15 9:27 gregkh
2019-12-15 18:03 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2019-12-15 9:27 UTC (permalink / raw)
To: mathias.nyman, gregkh, stable; +Cc: stable
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.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 4b870cd6c575..7a3a29e5e9d2 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -806,7 +806,7 @@ static void xhci_del_comp_mod_timer(struct xhci_hcd *xhci, u32 status,
static int xhci_handle_usb2_port_link_resume(struct xhci_port *port,
u32 *status, u32 portsc,
- unsigned long flags)
+ unsigned long *flags)
{
struct xhci_bus_state *bus_state;
struct xhci_hcd *xhci;
@@ -860,11 +860,11 @@ static int xhci_handle_usb2_port_link_resume(struct xhci_port *port,
xhci_test_and_clear_bit(xhci, port, PORT_PLC);
xhci_set_link_state(xhci, port, XDEV_U0);
- spin_unlock_irqrestore(&xhci->lock, flags);
+ spin_unlock_irqrestore(&xhci->lock, *flags);
time_left = wait_for_completion_timeout(
&bus_state->rexit_done[wIndex],
msecs_to_jiffies(XHCI_MAX_REXIT_TIMEOUT_MS));
- spin_lock_irqsave(&xhci->lock, flags);
+ spin_lock_irqsave(&xhci->lock, *flags);
if (time_left) {
slot_id = xhci_find_slot_id_by_port(hcd, xhci,
@@ -967,7 +967,7 @@ static void xhci_get_usb3_port_status(struct xhci_port *port, u32 *status,
}
static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status,
- u32 portsc, unsigned long flags)
+ u32 portsc, unsigned long *flags)
{
struct xhci_bus_state *bus_state;
u32 link_state;
@@ -1017,7 +1017,7 @@ static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status,
static u32 xhci_get_port_status(struct usb_hcd *hcd,
struct xhci_bus_state *bus_state,
u16 wIndex, u32 raw_port_status,
- unsigned long flags)
+ unsigned long *flags)
__releases(&xhci->lock)
__acquires(&xhci->lock)
{
@@ -1140,7 +1140,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
}
trace_xhci_get_port_status(wIndex, temp);
status = xhci_get_port_status(hcd, bus_state, wIndex, temp,
- flags);
+ &flags);
if (status == 0xffffffff)
goto error;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: FAILED: patch "[PATCH] xhci: make sure interrupts are restored to correct state" failed to apply to 4.19-stable tree
2019-12-15 9:27 FAILED: patch "[PATCH] xhci: make sure interrupts are restored to correct state" failed to apply to 4.19-stable tree gregkh
@ 2019-12-15 18:03 ` Sasha Levin
2019-12-16 7:30 ` Mathias Nyman
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2019-12-15 18:03 UTC (permalink / raw)
To: gregkh; +Cc: mathias.nyman, stable
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.com
>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.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: FAILED: patch "[PATCH] xhci: make sure interrupts are restored to correct state" failed to apply to 4.19-stable tree
2019-12-15 18:03 ` Sasha Levin
@ 2019-12-16 7:30 ` Mathias Nyman
0 siblings, 0 replies; 3+ messages in thread
From: Mathias Nyman @ 2019-12-16 7:30 UTC (permalink / raw)
To: Sasha Levin, gregkh; +Cc: stable
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.com
>> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-16 7:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-15 9:27 FAILED: patch "[PATCH] xhci: make sure interrupts are restored to correct state" failed to apply to 4.19-stable tree gregkh
2019-12-15 18:03 ` Sasha Levin
2019-12-16 7:30 ` Mathias Nyman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox