Commit 09710020 authored by Bin Liu's avatar Bin Liu Committed by Greg Kroah-Hartman

usb: musb: trace: fix NULL pointer dereference in musb_g_tx()

commit 9aea9b6c upstream.

The usb_request pointer could be NULL in musb_g_tx(), where the
tracepoint call would trigger the NULL pointer dereference failure when
parsing the members of the usb_request pointer.

Move the tracepoint call to where the usb_request pointer is already
checked to solve the issue.

Fixes: fc78003e ("usb: musb: gadget: add usb-request tracepoints")
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f3ac2e8
...@@ -442,7 +442,6 @@ void musb_g_tx(struct musb *musb, u8 epnum) ...@@ -442,7 +442,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
req = next_request(musb_ep); req = next_request(musb_ep);
request = &req->request; request = &req->request;
trace_musb_req_tx(req);
csr = musb_readw(epio, MUSB_TXCSR); csr = musb_readw(epio, MUSB_TXCSR);
musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr);
...@@ -481,6 +480,8 @@ void musb_g_tx(struct musb *musb, u8 epnum) ...@@ -481,6 +480,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
u8 is_dma = 0; u8 is_dma = 0;
bool short_packet = false; bool short_packet = false;
trace_musb_req_tx(req);
if (dma && (csr & MUSB_TXCSR_DMAENAB)) { if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
is_dma = 1; is_dma = 1;
csr |= MUSB_TXCSR_P_WZC_BITS; csr |= MUSB_TXCSR_P_WZC_BITS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment