usb: musb: host: fix potential NULL pointer dereference
authorBin Liu <b-liu@ti.com>
Mon, 30 Apr 2018 16:20:53 +0000 (11:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 May 2018 07:51:55 +0000 (09:51 +0200)
commit303e99bde8dcb6beaa6be738e025f9f9dd2703f1
tree3f79f80d481ee0f9ae6fa930655979ad7a5be367
parentec6de93fab502d0b10c5acc4e5c4ef7cfb8f807b
usb: musb: host: fix potential NULL pointer dereference

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 <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_host.c