* [PATCH iwl-net v2] igc: fix potential skb leak in igc_fpe_xmit_smd_frame()
@ 2026-04-15 2:52 Kohei Enju
2026-04-17 11:51 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Kohei Enju @ 2026-04-15 2:52 UTC (permalink / raw)
To: intel-wired-lan, netdev
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Faizal Rahim,
kohei.enju, Kohei Enju, stable
When igc_fpe_init_tx_descriptor() fails, no one takes care of an
allocated skb, leaking it. [1]
Use dev_kfree_skb_any() on failure.
Tested on an I226 adapter with the following command, while injecting
faults in igc_fpe_init_tx_descriptor() to trigger the error path.
# ethtool --set-mm $DEV verify-enabled on tx-enabled on pmac-enabled on
[1]
unreferenced object 0xffff888113c6cdc0 (size 224):
...
backtrace (crc be3d3fda):
kmem_cache_alloc_node_noprof+0x3b1/0x410
__alloc_skb+0xde/0x830
igc_fpe_xmit_smd_frame.isra.0+0xad/0x1b0
igc_fpe_send_mpacket+0x37/0x90
ethtool_mmsv_verify_timer+0x15e/0x300
Cc: stable@vger.kernel.org
Fixes: 5422570c0010 ("igc: add support for frame preemption verification")
Signed-off-by: Kohei Enju <kohei@enjuk.jp>
---
Changes:
v2:
- change to idiomatic style with goto (Simon)
- add Cc to stable (Alex)
- add reprodunction steps (Alex)
v1: https://lore.kernel.org/all/20260329145122.126040-1-kohei@enjuk.jp/
---
drivers/net/ethernet/intel/igc/igc_tsn.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index 8a110145bfee..02dd9f0290a3 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -109,10 +109,16 @@ static int igc_fpe_xmit_smd_frame(struct igc_adapter *adapter,
__netif_tx_lock(nq, cpu);
err = igc_fpe_init_tx_descriptor(ring, skb, type);
- igc_flush_tx_descriptors(ring);
+ if (err)
+ goto err_free_skb_any;
+ igc_flush_tx_descriptors(ring);
__netif_tx_unlock(nq);
+ return 0;
+err_free_skb_any:
+ __netif_tx_unlock(nq);
+ dev_kfree_skb_any(skb);
return err;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iwl-net v2] igc: fix potential skb leak in igc_fpe_xmit_smd_frame()
2026-04-15 2:52 [PATCH iwl-net v2] igc: fix potential skb leak in igc_fpe_xmit_smd_frame() Kohei Enju
@ 2026-04-17 11:51 ` Simon Horman
2026-04-17 16:20 ` [Intel-wired-lan] " Kohei Enju
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2026-04-17 11:51 UTC (permalink / raw)
To: Kohei Enju
Cc: intel-wired-lan, netdev, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Faizal Rahim, kohei.enju, stable
On Wed, Apr 15, 2026 at 02:52:18AM +0000, Kohei Enju wrote:
> When igc_fpe_init_tx_descriptor() fails, no one takes care of an
> allocated skb, leaking it. [1]
> Use dev_kfree_skb_any() on failure.
>
> Tested on an I226 adapter with the following command, while injecting
> faults in igc_fpe_init_tx_descriptor() to trigger the error path.
> # ethtool --set-mm $DEV verify-enabled on tx-enabled on pmac-enabled on
>
> [1]
> unreferenced object 0xffff888113c6cdc0 (size 224):
> ...
> backtrace (crc be3d3fda):
> kmem_cache_alloc_node_noprof+0x3b1/0x410
> __alloc_skb+0xde/0x830
> igc_fpe_xmit_smd_frame.isra.0+0xad/0x1b0
> igc_fpe_send_mpacket+0x37/0x90
> ethtool_mmsv_verify_timer+0x15e/0x300
>
> Cc: stable@vger.kernel.org
> Fixes: 5422570c0010 ("igc: add support for frame preemption verification")
> Signed-off-by: Kohei Enju <kohei@enjuk.jp>
> ---
> Changes:
> v2:
> - change to idiomatic style with goto (Simon)
> - add Cc to stable (Alex)
> - add reprodunction steps (Alex)
> v1: https://lore.kernel.org/all/20260329145122.126040-1-kohei@enjuk.jp/
Thanks for the update.
Reviewed-by: Simon Horman <horms@kernel.org>
Sashiko has comments about a potential existing bug in the same code path.
I'd appreciate it if, as a follow-up, you could look over that.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Intel-wired-lan] [PATCH iwl-net v2] igc: fix potential skb leak in igc_fpe_xmit_smd_frame()
2026-04-17 11:51 ` Simon Horman
@ 2026-04-17 16:20 ` Kohei Enju
0 siblings, 0 replies; 3+ messages in thread
From: Kohei Enju @ 2026-04-17 16:20 UTC (permalink / raw)
To: Simon Horman
Cc: intel-wired-lan, netdev, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Faizal Rahim, kohei.enju, stable
On 04/17 12:51, Simon Horman wrote:
> On Wed, Apr 15, 2026 at 02:52:18AM +0000, Kohei Enju wrote:
> > When igc_fpe_init_tx_descriptor() fails, no one takes care of an
> > allocated skb, leaking it. [1]
> > Use dev_kfree_skb_any() on failure.
> >
> > Tested on an I226 adapter with the following command, while injecting
> > faults in igc_fpe_init_tx_descriptor() to trigger the error path.
> > # ethtool --set-mm $DEV verify-enabled on tx-enabled on pmac-enabled on
> >
> > [1]
> > unreferenced object 0xffff888113c6cdc0 (size 224):
> > ...
> > backtrace (crc be3d3fda):
> > kmem_cache_alloc_node_noprof+0x3b1/0x410
> > __alloc_skb+0xde/0x830
> > igc_fpe_xmit_smd_frame.isra.0+0xad/0x1b0
> > igc_fpe_send_mpacket+0x37/0x90
> > ethtool_mmsv_verify_timer+0x15e/0x300
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 5422570c0010 ("igc: add support for frame preemption verification")
> > Signed-off-by: Kohei Enju <kohei@enjuk.jp>
> > ---
> > Changes:
> > v2:
> > - change to idiomatic style with goto (Simon)
> > - add Cc to stable (Alex)
> > - add reprodunction steps (Alex)
> > v1: https://lore.kernel.org/all/20260329145122.126040-1-kohei@enjuk.jp/
>
> Thanks for the update.
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
> Sashiko has comments about a potential existing bug in the same code path.
> I'd appreciate it if, as a follow-up, you could look over that.
Thanks for the heads-up. I'll look into it.
>
> Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-17 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15 2:52 [PATCH iwl-net v2] igc: fix potential skb leak in igc_fpe_xmit_smd_frame() Kohei Enju
2026-04-17 11:51 ` Simon Horman
2026-04-17 16:20 ` [Intel-wired-lan] " Kohei Enju
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox