Message ID | 20190508223329.26796-1-colin.king@canonical.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | dma: dw-axi-dmac: fix null dereference when pointer first is null | expand |
On 08-05-19, 23:33, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > In the unlikely event that axi_desc_get returns a null desc in the > very first iteration of the while-loop the error exit path ends > up calling axi_desc_put on a null pointer 'first' and this causes > a null pointer dereference. Fix this by adding a null check on > pointer 'first' before calling axi_desc_put. Applied, thanks
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index b2ac1d2c5b86..a1ce307c502f 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -512,7 +512,8 @@ dma_chan_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dst_adr, return vchan_tx_prep(&chan->vc, &first->vd, flags); err_desc_get: - axi_desc_put(first); + if (first) + axi_desc_put(first); return NULL; }