net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
Subsystems (3)
PATCH 1/1 net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
octep_vf_request_irqs() requests MSI-X queue IRQs with dev_id set to ioq_vector. If request_irq() fails part-way, the rollback loop calls free_irq() with dev_id set to 'oct', which does not match the original dev_id and may leave the irqaction registered.
This can keep IRQ handlers alive while ioq_vector is later freed during unwind/teardown, leading to a use-after-free or crash when an interrupt fires.
Fix the error path to free IRQs with the same ioq_vector dev_id used during request_irq().
--- drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c +1 -1
@@ -218,7 +218,7 @@ static int octep_vf_request_irqs(struct octep_vf_device *oct) ioq_irq_err:while (i) { --i; -free_irq (oct->msix_entries[i].vector, oct); +free_irq (oct->msix_entries[i].vector, oct->ioq_vector[i]); }return -1 ; }
Signature · 1 line
2.34.1
+ Maintainers
Quoted 9 lines · Kery Qi
octep_vf_request_irqs()requests MSI-X queue IRQs withdev_idset toioq_vector. Ifrequest_irq()fails part-way, the rollback loop callsfree_irq()withdev_idset to 'oct', which does not match the originaldev_idand may leave the irqaction registered.This can keep IRQ handlers alive while
ioq_vectoris later freed during unwind/teardown, leading to a use-after-free or crash when an interrupt fires.
Quoted 5 lines
Fix the error path to free IRQs with the same
ioq_vectordev_idused duringrequest_irq().Fixes 1cd3b407977c ("octeon_ep_vf: add Tx/Rx processing and interrupt support")Signed-off-by Kery Qi <[email protected]>
Thanks, I agree with your analysis; that the problem was introduced by the cited commit; and the proposed fixes.
Some notes on procedure For reference, if you post more networking fixes, or need to spin this patch for some reason.
1. As a bug fix for code present in the net tree it should be targeted at that tree.
Subject: [PATCH net] ...
2. Please include all maintainers and the patch author of the author commit. "./scripts/get_maintainer.pl this.patch" can with that.
3. For bug fixes, please consider the guidelines for stable submissions. I.e. CC; [email protected]
See also: https://docs.kernel.org/process/maintainer-netdev.html
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 9 Jan 2026 00:42:57 +0800 you wrote:
octep_vf_request_irqs()requests MSI-X queue IRQs withdev_idset toioq_vector. Ifrequest_irq()fails part-way, the rollback loop callsfree_irq()withdev_idset to 'oct', which does not match the originaldev_idand may leave the irqaction registered.This can keep IRQ handlers alive while
ioq_vectoris later freed during unwind/teardown, leading to a use-after-free or crash when an interrupt fires.[...]
Here is the summary with links:
- net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
https://git.kernel.org/netdev/net/c/f93fc5d12d69
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html