* dmaengine: ioat: possible use-after-free on probe failure
@ 2026-10-19 14:04 LI xiao
2026-10-19 14:18 ` Dave Jiang
0 siblings, 1 reply; 2+ messages in thread
From: LI xiao @ 2026-10-19 14:04 UTC (permalink / raw)
To: dave.jiang; +Cc: vkoul, dmaengine, linux-kernel
Hello,
I found a possible IRQ lifetime race in the Intel I/OAT DMA driver.
I reviewed the relevant code in Linux v7.3 at commit c03c1a14507dfaf8b856c2608f9ac216021fc222. In drivers/dma/ioat/init.c, ioat_dma_setup_interrupts() registers IRQ handlers using devm_request_irq(). In MSI-X mode, the handler receives an ioatdma_chan pointer, while in MSI/INTx mode, the handler receives an ioatdma_device pointer.
If initialization fails after the IRQ handlers have been registered, the err_disable_interrupts path disables device-side interrupts and returns. ioat_pci_probe() then frees the channel objects referenced by device->idx[] and the device itself before returning an error. Since managed IRQ cleanup occurs after the probe callback returns, an IRQ handler that is still running could access a freed channel or device object before the corresponding IRQ is released.
I tested the suspected lifetime ordering using a test-only kernel module in a mainline v7.3 KASAN-enabled QEMU guest. A test kthread retained a pointer to a simulated device object and waited while the cleanup path disabled simulated interrupts and freed the device. After the kthread resumed and accessed the retained pointer, KASAN reported:
BUG: KASAN: slab-use-after-free in ioat_irq_handler_repro+0x68/0x70 [ioat_probe_race_repro]
Read of size 8 at addr ff110001025c0388 by task ioat-irq-test/77
This is a controlled simulation of the lifetime ordering, not a reproduction through the actual I/OAT driver or hardware. The reported access occurred in the test module's handler, not the driver's actual IRQ handler. QEMU 6.2 does not provide an I/OAT device model, so I could not exercise the real probe-failure path.
Could you please assess whether this is a bug?
Best regards,
LI Xiao
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: dmaengine: ioat: possible use-after-free on probe failure
2026-10-19 14:04 dmaengine: ioat: possible use-after-free on probe failure LI xiao
@ 2026-10-19 14:18 ` Dave Jiang
0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2026-10-19 14:18 UTC (permalink / raw)
To: LI xiao; +Cc: vkoul, dmaengine, linux-kernel
On 10/19/26 7:04 AM, LI xiao wrote:
> Hello,
>
> I found a possible IRQ lifetime race in the Intel I/OAT DMA driver.
>
> I reviewed the relevant code in Linux v7.3 at commit c03c1a14507dfaf8b856c2608f9ac216021fc222. In drivers/dma/ioat/init.c, ioat_dma_setup_interrupts() registers IRQ handlers using devm_request_irq(). In MSI-X mode, the handler receives an ioatdma_chan pointer, while in MSI/INTx mode, the handler receives an ioatdma_device pointer.
>
> If initialization fails after the IRQ handlers have been registered, the err_disable_interrupts path disables device-side interrupts and returns. ioat_pci_probe() then frees the channel objects referenced by device->idx[] and the device itself before returning an error. Since managed IRQ cleanup occurs after the probe callback returns, an IRQ handler that is still running could access a freed channel or device object before the corresponding IRQ is released.
>
> I tested the suspected lifetime ordering using a test-only kernel module in a mainline v7.3 KASAN-enabled QEMU guest. A test kthread retained a pointer to a simulated device object and waited while the cleanup path disabled simulated interrupts and freed the device. After the kthread resumed and accessed the retained pointer, KASAN reported:
>
> BUG: KASAN: slab-use-after-free in ioat_irq_handler_repro+0x68/0x70 [ioat_probe_race_repro]
> Read of size 8 at addr ff110001025c0388 by task ioat-irq-test/77
>
> This is a controlled simulation of the lifetime ordering, not a reproduction through the actual I/OAT driver or hardware. The reported access occurred in the test module's handler, not the driver's actual IRQ handler. QEMU 6.2 does not provide an I/OAT device model, so I could not exercise the real probe-failure path.
>
> Could you please assess whether this is a bug?
>
> Best regards,
> LI Xiao
Thank you for the analysis. However given how old this hardware and driver is and there haven't been a field report on this issue, I won't spend the time and analyze this. Patches are welcome if you can reproduce it on hardware.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-19 14:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 14:04 dmaengine: ioat: possible use-after-free on probe failure LI xiao
2026-10-19 14:18 ` Dave Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox