Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9baa9d9 authored by Linus Walleij's avatar Linus Walleij Committed by Vinod Koul
Browse files

dma: ste_dma40: don't dereference free:d descriptor



It appears that in the DMA40 driver the DMA tasklet will very
often dereference memory for a descriptor just free:d from the
DMA40 slab. Nothing happens because no other part of the driver
has yet had a chance to claim this memory, but it's really
nasty to dereference free:d memory, so let's check the flag
before the descriptor is free and store it in a bool variable.

Cc: stable@vger.kernel.org
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent b28a960c
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long data)
	struct d40_chan *d40c = (struct d40_chan *) data;
	struct d40_chan *d40c = (struct d40_chan *) data;
	struct d40_desc *d40d;
	struct d40_desc *d40d;
	unsigned long flags;
	unsigned long flags;
	bool callback_active;
	dma_async_tx_callback callback;
	dma_async_tx_callback callback;
	void *callback_param;
	void *callback_param;


@@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long data)
	}
	}


	/* Callback to client */
	/* Callback to client */
	callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT);
	callback = d40d->txd.callback;
	callback = d40d->txd.callback;
	callback_param = d40d->txd.callback_param;
	callback_param = d40d->txd.callback_param;


@@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long data)


	spin_unlock_irqrestore(&d40c->lock, flags);
	spin_unlock_irqrestore(&d40c->lock, flags);


	if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT))
	if (callback_active && callback)
		callback(callback_param);
		callback(callback_param);


	return;
	return;