* dmaengine: k3dma: KASAN null-ptr-deref in k3_dma_int_handler() on early IRQ
@ 2026-06-10 10:47 Jaeyoung Chung
2026-06-11 5:15 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Jaeyoung Chung @ 2026-06-10 10:47 UTC (permalink / raw)
To: Vinod Koul, Frank Li
Cc: Jaeyoung Chung, dmaengine, linux-kernel, Sangyun Kim,
Kyungwook Boo
Hi,
k3_dma_probe() in drivers/dma/k3dma.c registers the interrupt handler
with devm_request_irq() before it initializes d->phy. If an interrupt
arrives before d->phy is initialized, k3_dma_int_handler() dereferences
a NULL d->phy, causing a kernel panic.
The probe path, in k3_dma_probe():
d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL); /* d->phy == NULL */
...
ret = devm_request_irq(&op->dev, irq,
k3_dma_int_handler, 0, DRIVER_NAME, d); /* register handler */
...
d->phy = devm_kcalloc(&op->dev,
d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); /* initialize d->phy */
The interrupt handler, k3_dma_int_handler(), dereferences d->phy without
check:
p = &d->phy[i];
c = p->vchan; /* NULL pointer dereference */
If the device raises an interrupt before d->phy is initialized, the
handler dereferences the NULL d->phy, triggering a KASAN
null-ptr-deref.
Suggested fix: move the d->phy = devm_kcalloc() assignment above
devm_request_irq(), so the d->phy array is valid before the
handler can run.
Reported-by: Sangyun Kim <sangyun.kim@snu.ac.kr>
Reported-by: Kyungwook Boo <bookyungwook@gmail.com>
Thanks,
Jaeyoung Chung
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: dmaengine: k3dma: KASAN null-ptr-deref in k3_dma_int_handler() on early IRQ
2026-06-10 10:47 dmaengine: k3dma: KASAN null-ptr-deref in k3_dma_int_handler() on early IRQ Jaeyoung Chung
@ 2026-06-11 5:15 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2026-06-11 5:15 UTC (permalink / raw)
To: Jaeyoung Chung
Cc: Frank Li, dmaengine, linux-kernel, Sangyun Kim, Kyungwook Boo
On 10-06-26, 19:47, Jaeyoung Chung wrote:
> Hi,
>
> k3_dma_probe() in drivers/dma/k3dma.c registers the interrupt handler
> with devm_request_irq() before it initializes d->phy. If an interrupt
> arrives before d->phy is initialized, k3_dma_int_handler() dereferences
> a NULL d->phy, causing a kernel panic.
>
> The probe path, in k3_dma_probe():
>
> d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL); /* d->phy == NULL */
> ...
> ret = devm_request_irq(&op->dev, irq,
> k3_dma_int_handler, 0, DRIVER_NAME, d); /* register handler */
> ...
> d->phy = devm_kcalloc(&op->dev,
> d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); /* initialize d->phy */
>
> The interrupt handler, k3_dma_int_handler(), dereferences d->phy without
> check:
>
> p = &d->phy[i];
> c = p->vchan; /* NULL pointer dereference */
>
> If the device raises an interrupt before d->phy is initialized, the
> handler dereferences the NULL d->phy, triggering a KASAN
> null-ptr-deref.
>
> Suggested fix: move the d->phy = devm_kcalloc() assignment above
> devm_request_irq(), so the d->phy array is valid before the
> handler can run.
Please send a patch
>
> Reported-by: Sangyun Kim <sangyun.kim@snu.ac.kr>
> Reported-by: Kyungwook Boo <bookyungwook@gmail.com>
>
> Thanks,
> Jaeyoung Chung
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-11 5:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 10:47 dmaengine: k3dma: KASAN null-ptr-deref in k3_dma_int_handler() on early IRQ Jaeyoung Chung
2026-06-11 5:15 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox