From: Bin Liu Date: Mon, 30 Apr 2018 16:20:53 +0000 (-0500) Subject: usb: musb: host: fix potential NULL pointer dereference X-Git-Tag: Ubuntu-4.15.0-33.36~397 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=aeaab388529b8d3728754c30a42ff4093bc61097;p=mirror_ubuntu-bionic-kernel.git usb: musb: host: fix potential NULL pointer dereference BugLink: http://bugs.launchpad.net/bugs/1778759 commit 2b63f1329df2cd814c1f8353fae4853ace6521d1 upstream. musb_start_urb() doesn't check the pass-in parameter if it is NULL. But in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is returned from first_qh(), which could be NULL. So wrap the musb_start_urb() call here with a if condition check to avoid the potential NULL pointer dereference. Fixes: f283862f3b5c ("usb: musb: NAK timeout scheme on bulk TX endpoint") Cc: stable@vger.kernel.org # v3.7+ Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 6f311212f3c5..a1ccfcbbef5c 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -998,7 +998,9 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, /* set tx_reinit and schedule the next qh */ ep->tx_reinit = 1; } - musb_start_urb(musb, is_in, next_qh); + + if (next_qh) + musb_start_urb(musb, is_in, next_qh); } }