mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
dmaengine: dw-edma: Initialize IRQ data before requesting IRQs
dw_edma_irq_request() passes struct dw_edma_irq to request_irq() before
dw_edma_channel_setup() fills the back pointer. A shared interrupt can
therefore enter the handler with dw_irq->dw still NULL, leading to a
NULL pointer dereference.
Set the back pointer before installing each handler.
Fixes: e63d79d1ff ("dmaengine: Add Synopsys eDMA IP core driver")
Cc: stable@vger.kernel.org
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Link: https://patch.msgid.link/20260721062815.4117887-5-den@valinux.co.jp
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
c9c25b2f32
commit
647217abea
|
|
@ -969,7 +969,6 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc)
|
|||
else
|
||||
bitmap_set(irq->rd_mask, chan->id, 1);
|
||||
|
||||
irq->dw = dw;
|
||||
memcpy(&chan->msi, &irq->msi, sizeof(chan->msi));
|
||||
|
||||
dev_vdbg(dev, "MSI:\t\tChannel %s[%u] addr=0x%.8x%.8x, data=0x%.8x\n",
|
||||
|
|
@ -1051,6 +1050,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
|
|||
if (chip->nr_irqs == 1) {
|
||||
/* Common IRQ shared among all channels */
|
||||
irq = chip->ops->irq_vector(dev, 0);
|
||||
dw->irq[0].dw = dw;
|
||||
err = request_irq(irq, dw_edma_interrupt_common,
|
||||
IRQF_SHARED, dw->name, &dw->irq[0]);
|
||||
if (err) {
|
||||
|
|
@ -1073,6 +1073,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
|
|||
|
||||
for (i = 0; i < (*wr_alloc + *rd_alloc); i++) {
|
||||
irq = chip->ops->irq_vector(dev, i);
|
||||
dw->irq[i].dw = dw;
|
||||
err = request_irq(irq,
|
||||
i < *wr_alloc ?
|
||||
dw_edma_interrupt_write :
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user