Commit 0abdc36f authored by Maulik Mankad's avatar Maulik Mankad Committed by Greg Kroah-Hartman

USB: musb: Fix null pointer dereference issue

This patch fixes the following NULL pointer dereference issue.

Pointer 'request' returned from call to function 'next_request'
at line 748 may be NULL and may be dereferenced at line 792.

============
Code Snippet
============

748:  request = next_request(musb_ep);
785: if (dma && (csr & MUSB_RXCSR_DMAENAB)) {
	csr &= ~(MUSB_RXCSR_AUTOCLEAR
			| MUSB_RXCSR_DMAENAB
			| MUSB_RXCSR_DMAMODE);
	musb_writew(epio, MUSB_RXCSR,
		MUSB_RXCSR_P_WZC_BITS | csr);

792:	 request->actual += musb_ep->dma->actual_len;
Signed-off-by: default avatarMaulik Mankad <x0082077@ti.com>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 796a83fa
...@@ -746,6 +746,8 @@ void musb_g_rx(struct musb *musb, u8 epnum) ...@@ -746,6 +746,8 @@ void musb_g_rx(struct musb *musb, u8 epnum)
musb_ep_select(mbase, epnum); musb_ep_select(mbase, epnum);
request = next_request(musb_ep); request = next_request(musb_ep);
if (!request)
return;
csr = musb_readw(epio, MUSB_RXCSR); csr = musb_readw(epio, MUSB_RXCSR);
dma = is_dma_capable() ? musb_ep->dma : NULL; dma = is_dma_capable() ? musb_ep->dma : NULL;
......
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