* [PATCH net] ice: fix metadata_dst refcount handling on representor teardown
@ 2026-08-16 13:55 ` Tristan Madani
0 siblings, 0 replies; 3+ messages in thread
From: Tristan Madani @ 2026-08-16 13:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel
Cc: Grzegorz Nitka, Michal Swiatkowski, Andrew Lunn, David S . Miller,
Jakub Kicinski, Eric Dumazet, Paolo Abeni, intel-wired-lan,
netdev, stable, Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
ice_eswitch_release_repr() uses metadata_dst_free() to release the
representor's metadata_dst. metadata_dst_free() directly frees the
underlying memory without checking the dst_entry refcount.
When ice_eswitch_port_start_xmit() processes a packet, it takes a
reference via dst_hold() and attaches the metadata_dst to the skb.
If the representor is torn down while packets are still queued on
the lower device (e.g. in a qdisc), the metadata_dst is freed while
references are still held.
Use dst_release() instead, which correctly decrements the refcount
and only frees the object when all references are dropped. The dst
subsystem already handles metadata_dst cleanup in dst_destroy() when
DST_METADATA is set.
Other drivers sharing this pattern (nfp, airoha, bnxt) already use
dst_release() for their metadata_dst lifecycle.
Fixes: f5396b8a663f7 ("ice: switchdev slow path")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/ethernet/intel/ice/ice_eswitch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
index c30e27bbfe6e2..96174fca3984a 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
@@ -95,7 +95,7 @@ ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr)
return;
ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
- metadata_dst_free(repr->dst);
+ dst_release(&repr->dst->dst);
repr->dst = NULL;
ice_fltr_add_mac_and_broadcast(vsi, repr->parent_mac,
ICE_FWD_TO_VSI);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Intel-wired-lan] [PATCH net] ice: fix metadata_dst refcount handling on representor teardown
@ 2026-08-16 13:55 ` Tristan Madani
0 siblings, 0 replies; 3+ messages in thread
From: Tristan Madani @ 2026-08-16 13:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel
Cc: netdev, stable, Tristan Madani, Andrew Lunn, Eric Dumazet,
intel-wired-lan, Jakub Kicinski, Michal Swiatkowski, Paolo Abeni,
David S . Miller
From: Tristan Madani <tristan@talencesecurity.com>
ice_eswitch_release_repr() uses metadata_dst_free() to release the
representor's metadata_dst. metadata_dst_free() directly frees the
underlying memory without checking the dst_entry refcount.
When ice_eswitch_port_start_xmit() processes a packet, it takes a
reference via dst_hold() and attaches the metadata_dst to the skb.
If the representor is torn down while packets are still queued on
the lower device (e.g. in a qdisc), the metadata_dst is freed while
references are still held.
Use dst_release() instead, which correctly decrements the refcount
and only frees the object when all references are dropped. The dst
subsystem already handles metadata_dst cleanup in dst_destroy() when
DST_METADATA is set.
Other drivers sharing this pattern (nfp, airoha, bnxt) already use
dst_release() for their metadata_dst lifecycle.
Fixes: f5396b8a663f7 ("ice: switchdev slow path")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/ethernet/intel/ice/ice_eswitch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
index c30e27bbfe6e2..96174fca3984a 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
@@ -95,7 +95,7 @@ ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr)
return;
ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
- metadata_dst_free(repr->dst);
+ dst_release(&repr->dst->dst);
repr->dst = NULL;
ice_fltr_add_mac_and_broadcast(vsi, repr->parent_mac,
ICE_FWD_TO_VSI);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] ice: fix metadata_dst refcount handling on representor teardown
2026-08-16 13:55 ` [Intel-wired-lan] " Tristan Madani
(?)
@ 2026-08-19 15:51 ` Simon Horman
-1 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-08-19 15:51 UTC (permalink / raw)
To: Tristan Madani
Cc: Tony Nguyen, Przemek Kitszel, Grzegorz Nitka, Michal Swiatkowski,
Andrew Lunn, David S . Miller, Jakub Kicinski, Eric Dumazet,
Paolo Abeni, intel-wired-lan, netdev, stable, Tristan Madani
On Sun, Aug 16, 2026 at 01:55:10PM +0000, Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
>
> ice_eswitch_release_repr() uses metadata_dst_free() to release the
> representor's metadata_dst. metadata_dst_free() directly frees the
> underlying memory without checking the dst_entry refcount.
>
> When ice_eswitch_port_start_xmit() processes a packet, it takes a
> reference via dst_hold() and attaches the metadata_dst to the skb.
> If the representor is torn down while packets are still queued on
> the lower device (e.g. in a qdisc), the metadata_dst is freed while
> references are still held.
>
> Use dst_release() instead, which correctly decrements the refcount
> and only frees the object when all references are dropped. The dst
> subsystem already handles metadata_dst cleanup in dst_destroy() when
> DST_METADATA is set.
>
> Other drivers sharing this pattern (nfp, airoha, bnxt) already use
> dst_release() for their metadata_dst lifecycle.
>
> Fixes: f5396b8a663f7 ("ice: switchdev slow path")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-19 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-16 13:55 [PATCH net] ice: fix metadata_dst refcount handling on representor teardown Tristan Madani
2026-08-16 13:55 ` [Intel-wired-lan] " Tristan Madani
2026-08-19 15:51 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.