* RE: [Intel-wired-lan] [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
2025-08-18 15:39 [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path Michal Schmidt
@ 2025-08-18 16:28 ` Loktionov, Aleksandr
2025-08-19 6:05 ` Subbaraya Sundeep
2025-09-04 11:49 ` [Intel-wired-lan] " Rinitha, SX
2 siblings, 0 replies; 5+ messages in thread
From: Loktionov, Aleksandr @ 2025-08-18 16:28 UTC (permalink / raw)
To: Schmidt, Michal, Nguyen, Anthony L, Kitszel, Przemyslaw,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Jesse Brandeburg, Alexander Duyck
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Michal Schmidt
> Sent: Monday, August 18, 2025 5:39 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; Jesse Brandeburg
> <jesse.brandeburg@intel.com>; Alexander Duyck
> <alexander.h.duyck@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH net] i40e: fix IRQ freeing in
> i40e_vsi_request_irq_msix error path
>
> If request_irq() in i40e_vsi_request_irq_msix() fails in an iteration
> later than the first, the error path wants to free the IRQs requested
> so far. However, it uses the wrong dev_id argument for free_irq(), so
> it does not free the IRQs correctly and instead triggers the warning:
>
> Trying to free already-free IRQ 173
> WARNING: CPU: 25 PID: 1091 at kernel/irq/manage.c:1829
> __free_irq+0x192/0x2c0
> Modules linked in: i40e(+) [...]
> CPU: 25 UID: 0 PID: 1091 Comm: NetworkManager Not tainted 6.17.0-rc1+
> #1 PREEMPT(lazy)
> Hardware name: [...]
> RIP: 0010:__free_irq+0x192/0x2c0
> [...]
> Call Trace:
> <TASK>
> free_irq+0x32/0x70
> i40e_vsi_request_irq_msix.cold+0x63/0x8b [i40e]
> i40e_vsi_request_irq+0x79/0x80 [i40e]
> i40e_vsi_open+0x21f/0x2f0 [i40e]
> i40e_open+0x63/0x130 [i40e]
> __dev_open+0xfc/0x210
> __dev_change_flags+0x1fc/0x240
> netif_change_flags+0x27/0x70
> do_setlink.isra.0+0x341/0xc70
> rtnl_newlink+0x468/0x860
> rtnetlink_rcv_msg+0x375/0x450
> netlink_rcv_skb+0x5c/0x110
> netlink_unicast+0x288/0x3c0
> netlink_sendmsg+0x20d/0x430
> ____sys_sendmsg+0x3a2/0x3d0
> ___sys_sendmsg+0x99/0xe0
> __sys_sendmsg+0x8a/0xf0
> do_syscall_64+0x82/0x2c0
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
> [...]
> </TASK>
> ---[ end trace 0000000000000000 ]---
>
> Use the same dev_id for free_irq() as for request_irq().
>
> I tested this with inserting code to fail intentionally.
>
> Fixes: 493fb30011b3 ("i40e: Move q_vectors from pointer to array to
> array of pointers")
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index b83f823e4917..dd21d93d39dd 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -4156,7 +4156,7 @@ static int i40e_vsi_request_irq_msix(struct
> i40e_vsi *vsi, char *basename)
> irq_num = pf->msix_entries[base + vector].vector;
> irq_set_affinity_notifier(irq_num, NULL);
> irq_update_affinity_hint(irq_num, NULL);
> - free_irq(irq_num, &vsi->q_vectors[vector]);
> + free_irq(irq_num, vsi->q_vectors[vector]);
> }
> return err;
> }
> --
> 2.50.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
2025-08-18 15:39 [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path Michal Schmidt
2025-08-18 16:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
@ 2025-08-19 6:05 ` Subbaraya Sundeep
2025-08-19 6:30 ` Michal Schmidt
2025-09-04 11:49 ` [Intel-wired-lan] " Rinitha, SX
2 siblings, 1 reply; 5+ messages in thread
From: Subbaraya Sundeep @ 2025-08-19 6:05 UTC (permalink / raw)
To: Michal Schmidt
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jesse Brandeburg,
Alexander Duyck, intel-wired-lan, netdev, linux-kernel
Hi Michal,
On 2025-08-18 at 15:39:03, Michal Schmidt (mschmidt@redhat.com) wrote:
> If request_irq() in i40e_vsi_request_irq_msix() fails in an iteration
> later than the first, the error path wants to free the IRQs requested
> so far. However, it uses the wrong dev_id argument for free_irq(), so
> it does not free the IRQs correctly and instead triggers the warning:
>
> Trying to free already-free IRQ 173
> WARNING: CPU: 25 PID: 1091 at kernel/irq/manage.c:1829 __free_irq+0x192/0x2c0
> Modules linked in: i40e(+) [...]
> CPU: 25 UID: 0 PID: 1091 Comm: NetworkManager Not tainted 6.17.0-rc1+ #1 PREEMPT(lazy)
> Hardware name: [...]
> RIP: 0010:__free_irq+0x192/0x2c0
> [...]
> Call Trace:
> <TASK>
> free_irq+0x32/0x70
> i40e_vsi_request_irq_msix.cold+0x63/0x8b [i40e]
> i40e_vsi_request_irq+0x79/0x80 [i40e]
> i40e_vsi_open+0x21f/0x2f0 [i40e]
> i40e_open+0x63/0x130 [i40e]
> __dev_open+0xfc/0x210
> __dev_change_flags+0x1fc/0x240
> netif_change_flags+0x27/0x70
> do_setlink.isra.0+0x341/0xc70
> rtnl_newlink+0x468/0x860
> rtnetlink_rcv_msg+0x375/0x450
> netlink_rcv_skb+0x5c/0x110
> netlink_unicast+0x288/0x3c0
> netlink_sendmsg+0x20d/0x430
> ____sys_sendmsg+0x3a2/0x3d0
> ___sys_sendmsg+0x99/0xe0
> __sys_sendmsg+0x8a/0xf0
> do_syscall_64+0x82/0x2c0
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
> [...]
> </TASK>
> ---[ end trace 0000000000000000 ]---
>
> Use the same dev_id for free_irq() as for request_irq().
>
> I tested this with inserting code to fail intentionally.
>
Nice. Looks like changing this in i40e_vsi_request_irq_msix was missed
during 493fb30011b3. Just a question isn't this not throwing any
compilation warning all these days?
Anyway LGTM.
Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>
Thanks,
Sundeep
> Fixes: 493fb30011b3 ("i40e: Move q_vectors from pointer to array to array of pointers")
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index b83f823e4917..dd21d93d39dd 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -4156,7 +4156,7 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename)
> irq_num = pf->msix_entries[base + vector].vector;
> irq_set_affinity_notifier(irq_num, NULL);
> irq_update_affinity_hint(irq_num, NULL);
> - free_irq(irq_num, &vsi->q_vectors[vector]);
> + free_irq(irq_num, vsi->q_vectors[vector]);
> }
> return err;
> }
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
2025-08-19 6:05 ` Subbaraya Sundeep
@ 2025-08-19 6:30 ` Michal Schmidt
0 siblings, 0 replies; 5+ messages in thread
From: Michal Schmidt @ 2025-08-19 6:30 UTC (permalink / raw)
To: Subbaraya Sundeep
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jesse Brandeburg,
Alexander Duyck, intel-wired-lan, netdev, linux-kernel
On Tue, Aug 19, 2025 at 8:05 AM Subbaraya Sundeep <sbhatta@marvell.com> wrote:
> Hi Michal,
> On 2025-08-18 at 15:39:03, Michal Schmidt (mschmidt@redhat.com) wrote:
> > Use the same dev_id for free_irq() as for request_irq().
> >
> > I tested this with inserting code to fail intentionally.
> >
> Nice. Looks like changing this in i40e_vsi_request_irq_msix was missed
> during 493fb30011b3. Just a question isn't this not throwing any
> compilation warning all these days?
No warnings, because the type of the dev_id parameter is a void pointer.
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [Intel-wired-lan] [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
2025-08-18 15:39 [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path Michal Schmidt
2025-08-18 16:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-08-19 6:05 ` Subbaraya Sundeep
@ 2025-09-04 11:49 ` Rinitha, SX
2 siblings, 0 replies; 5+ messages in thread
From: Rinitha, SX @ 2025-09-04 11:49 UTC (permalink / raw)
To: Schmidt, Michal, Nguyen, Anthony L, Kitszel, Przemyslaw,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Jesse Brandeburg, Alexander Duyck
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Michal Schmidt
> Sent: 18 August 2025 21:09
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Jesse Brandeburg <jesse.brandeburg@intel.com>; Alexander Duyck <alexander.h.duyck@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH net] i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
>
> If request_irq() in i40e_vsi_request_irq_msix() fails in an iteration later than the first, the error path wants to free the IRQs requested so far. However, it uses the wrong dev_id argument for free_irq(), so it does not free the IRQs correctly and instead triggers the warning:
>
> Trying to free already-free IRQ 173
> WARNING: CPU: 25 PID: 1091 at kernel/irq/manage.c:1829 __free_irq+0x192/0x2c0 Modules linked in: i40e(+) [...]
> CPU: 25 UID: 0 PID: 1091 Comm: NetworkManager Not tainted 6.17.0-rc1+ #1 PREEMPT(lazy) Hardware name: [...]
> RIP: 0010:__free_irq+0x192/0x2c0
> [...]
> Call Trace:
> <TASK>
> free_irq+0x32/0x70
> i40e_vsi_request_irq_msix.cold+0x63/0x8b [i40e]
> i40e_vsi_request_irq+0x79/0x80 [i40e]
> i40e_vsi_open+0x21f/0x2f0 [i40e]
> i40e_open+0x63/0x130 [i40e]
> __dev_open+0xfc/0x210
> __dev_change_flags+0x1fc/0x240
> netif_change_flags+0x27/0x70
> do_setlink.isra.0+0x341/0xc70
> rtnl_newlink+0x468/0x860
> rtnetlink_rcv_msg+0x375/0x450
> netlink_rcv_skb+0x5c/0x110
> netlink_unicast+0x288/0x3c0
> netlink_sendmsg+0x20d/0x430
____sys_sendmsg+0x3a2/0x3d0
___sys_sendmsg+0x99/0xe0
__sys_sendmsg+0x8a/0xf0
do_syscall_64+0x82/0x2c0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
[...]
> </TASK>
> ---[ end trace 0000000000000000 ]---
>
> Use the same dev_id for free_irq() as for request_irq().
>
> I tested this with inserting code to fail intentionally.
>
> Fixes: 493fb30011b3 ("i40e: Move q_vectors from pointer to array to array of pointers")
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 5+ messages in thread