public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
@ 2026-01-08 16:42 Kery Qi
  2026-01-12 19:56 ` Simon Horman
  2026-01-12 20:57 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Kery Qi @ 2026-01-08 16:42 UTC (permalink / raw)
  To: vburru; +Cc: netdev, Kery Qi

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().

Fixes: 1cd3b407977c ("octeon_ep_vf: add Tx/Rx processing and interrupt support")
Signed-off-by: Kery Qi <qikeyu2017@gmail.com>
---
 drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
index 420c3f4cf741..1d9760b4b8f4 100644
--- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
+++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
@@ -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;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
  2026-01-08 16:42 [PATCH] net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback Kery Qi
@ 2026-01-12 19:56 ` Simon Horman
  2026-01-12 20:57 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-01-12 19:56 UTC (permalink / raw)
  To: Kery Qi
  Cc: vburru, netdev, srasheed, pabeni, sedara, andrew+netdev, sburla,
	kuba, edumazet

+ Maintainers

On Fri, Jan 09, 2026 at 12:42:57AM +0800, Kery Qi wrote:
> 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().
> 
> Fixes: 1cd3b407977c ("octeon_ep_vf: add Tx/Rx processing and interrupt support")
> Signed-off-by: Kery Qi <qikeyu2017@gmail.com>

Thanks, I agree with your analysis; that the problem was introduced
by the cited commit; and the proposed fixes.

Reviewed-by: Simon Horman <horms@kernel.org>

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; stable@vger.kernel.org

See also: https://docs.kernel.org/process/maintainer-netdev.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
  2026-01-08 16:42 [PATCH] net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback Kery Qi
  2026-01-12 19:56 ` Simon Horman
@ 2026-01-12 20:57 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-12 20:57 UTC (permalink / raw)
  To: Kery Qi; +Cc: vburru, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  9 Jan 2026 00:42:57 +0800 you wrote:
> 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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-12 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 16:42 [PATCH] net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback Kery Qi
2026-01-12 19:56 ` Simon Horman
2026-01-12 20:57 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox