mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-16 23:45:31 +08:00
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>
This commit is contained in:
parent
02da2d7217
commit
607fb0f4d9
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user