summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTal Shorer <tal.shorer@gmail.com>2016-04-25 22:53:29 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-26 23:50:02 +0200
commit607fb0f4d90cc9a4463bcb17c1417d8a709dfda1 (patch)
tree8179c4aa0618d839650e8c81a056d5a626179b58 /drivers
parentLinux 4.6-rc5 (diff)
downloadlinux-607fb0f4d90cc9a4463bcb17c1417d8a709dfda1.tar.xz
linux-607fb0f4d90cc9a4463bcb17c1417d8a709dfda1.zip
usb: musb: gadget: nuke endpoint before setting its descriptor to NULL
Some functions, such as f_sourcesink, rely on an endpoint's desc field during their requests' complete() callback, so clear it only _after_ nuking all requests to avoid NULL pointer dereference. Signed-off-by: Tal Shorer <tal.shorer@gmail.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/musb_gadget.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 87bd578799a8..152865b36522 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1164,12 +1164,12 @@ static int musb_gadget_disable(struct usb_ep *ep)
musb_writew(epio, MUSB_RXMAXP, 0);
}
- musb_ep->desc = NULL;
- musb_ep->end_point.desc = NULL;
-
/* abort all pending DMA and requests */
nuke(musb_ep, -ESHUTDOWN);
+ musb_ep->desc = NULL;
+ musb_ep->end_point.desc = NULL;
+
schedule_work(&musb->irq_work);
spin_unlock_irqrestore(&(musb->lock), flags);