aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-02-13 04:39:01 -0500
committerVinod Koul <vinod.koul@intel.com>2014-02-17 03:36:58 -0500
commite9baa9d9d520fb0e24cca671e430689de2d4a4b2 (patch)
tree2213cad96b18839d3c86324d8937fc279bc8746c /drivers/dma
parentb28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff)
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: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/ste_dma40.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 00a2de957b23..bf18c786ed40 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long data)
1641 struct d40_chan *d40c = (struct d40_chan *) data; 1641 struct d40_chan *d40c = (struct d40_chan *) data;
1642 struct d40_desc *d40d; 1642 struct d40_desc *d40d;
1643 unsigned long flags; 1643 unsigned long flags;
1644 bool callback_active;
1644 dma_async_tx_callback callback; 1645 dma_async_tx_callback callback;
1645 void *callback_param; 1646 void *callback_param;
1646 1647
@@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long data)
1668 } 1669 }
1669 1670
1670 /* Callback to client */ 1671 /* Callback to client */
1672 callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT);
1671 callback = d40d->txd.callback; 1673 callback = d40d->txd.callback;
1672 callback_param = d40d->txd.callback_param; 1674 callback_param = d40d->txd.callback_param;
1673 1675
@@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long data)
1690 1692
1691 spin_unlock_irqrestore(&d40c->lock, flags); 1693 spin_unlock_irqrestore(&d40c->lock, flags);
1692 1694
1693 if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT)) 1695 if (callback_active && callback)
1694 callback(callback_param); 1696 callback(callback_param);
1695 1697
1696 return; 1698 return;