Skip to contentSkip to conversation

dma: jz4740: Null pointer dereference

DISCUSSION Stefan Agner 2 participants 2 messages Jul 8, 2014 MIPS

lore
Share & tools
lore
#0 lore raw

Hi Lars,

While looking through different DMA drivers, just stumbled upon this inside jz4740_dma_chan_irq:

if (chan->next_sg == chan->desc->num_sgs) {
	chan->desc = NULL;
	vchan_cookie_complete(&chan->desc->vdesc);
                                         ^ null pointer dereference
}

I'm not sure what the correct fix is, hence I thought I report it to you as author of the driver.

--
Stefan

#1 lore raw
Quoted 5 lines · Stefan Agner

Hi Lars,

While looking through different DMA drivers, just stumbled upon this inside jz4740_dma_chan_irq:

Quoted 8 lines
if (chan->next_sg == chan->desc->num_sgs) {
	chan->desc = NULL;
	vchan_cookie_complete(&chan->desc->vdesc);
                                          ^ null pointer dereference
}

I'm not sure what the correct fix is, hence I thought I report it to you as author of the driver.

Hi,

Thanks for the report. Yes this is a bug and I have a fix for it. Currently that codepath is not exercised though (no non-cyclic users of the JZ4740 dmaengine driver), so the fix is not critical. It will be sent upstream soon together which a couple of other patches for this driver.

- Lars