usb: renesas_usbhs: fix NULL pointer dereference in xfer_work()
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Wed, 8 Jun 2016 07:32:49 +0000 (16:32 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Aug 2016 16:09:16 +0000 (18:09 +0200)
commit97917f45211d7e5c0afd5f4dc33982c096a26722
treee2f57931a78a4c655aed6c347e5a64a1e316aa86
parent3ab02b35d5ce7a161ff8ad141db207837015ad6c
usb: renesas_usbhs: fix NULL pointer dereference in xfer_work()

commit 4fdef698383db07d829da567e0e405fc41ff3a89 upstream.

This patch fixes an issue that the xfer_work() is possible to cause
NULL pointer dereference if the usb cable is disconnected while data
transfer is running.

In such case, a gadget driver may call usb_ep_disable()) before
xfer_work() is actually called. In this case, the usbhs_pkt_pop()
will call usbhsf_fifo_unselect(), and then usbhs_pipe_to_fifo()
in xfer_work() will return NULL.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/fifo.c