aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Liu <b-liu@ti.com>2018-04-30 12:20:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-30 12:52:17 -0400
commit9aea9b6cc78d2b99b23d84fb2e0bc6e464c6569e (patch)
tree9cc53a135cd4ec44af2ee6f0059045e9911c76cb
parent2b63f1329df2cd814c1f8353fae4853ace6521d1 (diff)
usb: musb: trace: fix NULL pointer dereference in musb_g_tx()
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: fc78003e5345 ("usb: musb: gadget: add usb-request tracepoints") Cc: stable@vger.kernel.org # v4.8+ Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/musb/musb_gadget.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index e564695c6c8d..71c5835ea9cd 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -417,7 +417,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
417 req = next_request(musb_ep); 417 req = next_request(musb_ep);
418 request = &req->request; 418 request = &req->request;
419 419
420 trace_musb_req_tx(req);
421 csr = musb_readw(epio, MUSB_TXCSR); 420 csr = musb_readw(epio, MUSB_TXCSR);
422 musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); 421 musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr);
423 422
@@ -456,6 +455,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
456 u8 is_dma = 0; 455 u8 is_dma = 0;
457 bool short_packet = false; 456 bool short_packet = false;
458 457
458 trace_musb_req_tx(req);
459
459 if (dma && (csr & MUSB_TXCSR_DMAENAB)) { 460 if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
460 is_dma = 1; 461 is_dma = 1;
461 csr |= MUSB_TXCSR_P_WZC_BITS; 462 csr |= MUSB_TXCSR_P_WZC_BITS;