aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-06-24 09:49:40 -0400
committerVinod Koul <vkoul@kernel.org>2019-07-05 03:15:56 -0400
commit4c89cc73d1da42ae48b5c5dfbfd12304d0b86786 (patch)
tree624c7e0af9e3bbd37d11f68c5d7fea7d4a6b946b
parentd1fdb6d8f6a4109a4263176c84b899076a5f8008 (diff)
dmaengine: jz4780: Fix an endian bug in IRQ handler
The "pending" variable was a u32 but we cast it to an unsigned long pointer when we do the for_each_set_bit() loop. The problem is that on big endian 64bit systems that results in an out of bounds read. Fixes: 4e4106f5e942 ("dmaengine: jz4780: Fix transfers being ACKed too soon") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/dma-jz4780.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index 263bee76ef0d..6b8c4c458e8a 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -718,12 +718,13 @@ static irqreturn_t jz4780_dma_irq_handler(int irq, void *data)
718{ 718{
719 struct jz4780_dma_dev *jzdma = data; 719 struct jz4780_dma_dev *jzdma = data;
720 unsigned int nb_channels = jzdma->soc_data->nb_channels; 720 unsigned int nb_channels = jzdma->soc_data->nb_channels;
721 uint32_t pending, dmac; 721 unsigned long pending;
722 uint32_t dmac;
722 int i; 723 int i;
723 724
724 pending = jz4780_dma_ctrl_readl(jzdma, JZ_DMA_REG_DIRQP); 725 pending = jz4780_dma_ctrl_readl(jzdma, JZ_DMA_REG_DIRQP);
725 726
726 for_each_set_bit(i, (unsigned long *)&pending, nb_channels) { 727 for_each_set_bit(i, &pending, nb_channels) {
727 if (jz4780_dma_chan_irq(jzdma, &jzdma->chan[i])) 728 if (jz4780_dma_chan_irq(jzdma, &jzdma->chan[i]))
728 pending &= ~BIT(i); 729 pending &= ~BIT(i);
729 } 730 }