]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.6/usb-ohci-don-t-mark-eds-as-ed_oper-if-scheduling-fails.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.6 / usb-ohci-don-t-mark-eds-as-ed_oper-if-scheduling-fails.patch
1 From c66f59ee5050447b3da92d36f5385a847990a894 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Micha=C5=82=20Pecio?= <michal.pecio@gmail.com>
3 Date: Tue, 7 Jun 2016 12:34:45 +0200
4 Subject: USB: OHCI: Don't mark EDs as ED_OPER if scheduling fails
5
6 From: MichaƂ Pecio <michal.pecio@gmail.com>
7
8 commit c66f59ee5050447b3da92d36f5385a847990a894 upstream.
9
10 Since ed_schedule begins with marking the ED as "operational",
11 the ED may be left in such state even if scheduling actually
12 fails.
13
14 This allows future submission attempts to smuggle this ED to the
15 hardware behind the scheduler's back and without linking it to
16 the ohci->eds_in_use list.
17
18 The former causes bandwidth saturation and data loss on isoc
19 endpoints, the latter crashes the kernel when attempt is made
20 to unlink such ED from this list.
21
22 Fix ed_schedule to update ED state only on successful return.
23
24 Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
25 Acked-by: Alan Stern <stern@rowland.harvard.edu>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/usb/host/ohci-q.c | 3 ++-
30 1 file changed, 2 insertions(+), 1 deletion(-)
31
32 --- a/drivers/usb/host/ohci-q.c
33 +++ b/drivers/usb/host/ohci-q.c
34 @@ -183,7 +183,6 @@ static int ed_schedule (struct ohci_hcd
35 {
36 int branch;
37
38 - ed->state = ED_OPER;
39 ed->ed_prev = NULL;
40 ed->ed_next = NULL;
41 ed->hwNextED = 0;
42 @@ -259,6 +258,8 @@ static int ed_schedule (struct ohci_hcd
43 /* the HC may not see the schedule updates yet, but if it does
44 * then they'll be properly ordered.
45 */
46 +
47 + ed->state = ED_OPER;
48 return 0;
49 }
50