usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fri, 22 Aug 2014 11:13:50 +0000 (20:13 +0900)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Nov 2017 21:12:42 +0000 (22:12 +0100)
commit58e47d437d911efef76319fed7578eb6a4f00a7a
treef3223db165ee5be65169db59375d9c65841b9dfa
parent75894adb0c708c9f3617f8921d98c750b821de1a
usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle

commit 8355b2b3082d302091506703d2e4e239f7deed7f upstream.

Some gadget drivers will call usb_ep_queue() more than once before
the first queue doesn't finish. However, this driver didn't handle
it correctly. So, this patch fixes the behavior of some
usbhs_pkt_handle using the "running" flag. Otherwise, the oops below
happens if we use g_ncm driver and when the "iperf -u -c host -b 200M"
is running.

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000007 [#1] SMP ARM
Modules linked in: usb_f_ncm g_ncm libcomposite u_ether
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W      3.17.0-rc1-00008-g8b2be8a-dirty #20
task: c051c7e0 ti: c0512000 task.ti: c0512000
PC is at 0x0
LR is at usbhsf_pkt_handler+0xa8/0x114
pc : [<00000000>]    lr : [<c0278fb4>]    psr: 60000193
sp : c0513ce8  ip : c0513c58  fp : c0513d24
r10: 00000001  r9 : 00000193  r8 : eebec4a0
r7 : eebec410  r6 : eebe0c6c  r5 : 00000000  r4 : ee4a2774
r3 : 00000000  r2 : ee251e00  r1 : c0513cf4  r0 : ee4a2774

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/usb/renesas_usbhs/fifo.c
drivers/usb/renesas_usbhs/pipe.c
drivers/usb/renesas_usbhs/pipe.h