Skip to content

Commit 9aea9b6

Browse files
liubiingregkh
authored andcommitted
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: 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 2b63f13 commit 9aea9b6

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
@@ -417,7 +417,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
417417
req = next_request(musb_ep);
418418
request = &req->request;
419419

420-
trace_musb_req_tx(req);
421420
csr = musb_readw(epio, MUSB_TXCSR);
422421
musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr);
423422

@@ -456,6 +455,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
456455
u8 is_dma = 0;
457456
bool short_packet = false;
458457

458+
trace_musb_req_tx(req);
459+
459460
if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
460461
is_dma = 1;
461462
csr |= MUSB_TXCSR_P_WZC_BITS;

0 commit comments

Comments
 (0)