Skip to content

Commit 87fa7da

Browse files
liubiingregkh
authored andcommitted
usb: musb: trace: fix NULL pointer dereference in musb_g_tx()
commit 9aea9b6 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: fc78003 ("usb: musb: gadget: add usb-request tracepoints") Cc: [email protected] # v4.8+ Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 303e99b commit 87fa7da

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/musb/musb_gadget.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
442442
req = next_request(musb_ep);
443443
request = &req->request;
444444

445-
trace_musb_req_tx(req);
446445
csr = musb_readw(epio, MUSB_TXCSR);
447446
musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr);
448447

@@ -481,6 +480,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
481480
u8 is_dma = 0;
482481
bool short_packet = false;
483482

483+
trace_musb_req_tx(req);
484+
484485
if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
485486
is_dma = 1;
486487
csr |= MUSB_TXCSR_P_WZC_BITS;

0 commit comments

Comments
 (0)