> - [High] The fix is incomplete.
As the cover letter says, there is a patch for that bug pending review.
> - [Low] macvlan: Fixes tag cites act_ct instead of macvlan source-mode
> commit
I will take a look into this and respin with a changed tag if the route is real.
On Fri, Dec 4, 2026 at 2:21 AM <netd…@kernel.org> wrote:
>
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 1 · Medium: 0 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [High] The fix is incomplete.
> - [Low] macvlan: Fixes tag cites act_ct instead of macvlan source-mode
> commit
>
> --
>
> macvlan: drop the conntrack entry of source-mode clones to fix a double free
>
> This patch calls nf_reset_ct() on the clone that
> macvlan_forward_source_one() creates. The clone handed to a source-mode
> macvlan device then no longer shares the original skb's unconfirmed
> conntrack entry. Without this, the original and the clone can both run
> nf_ct_ext_add() on the same entry from different CPUs and double free
> ct->ext.
>
> > diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> > index 4f8416bb5169b..7fb584621fa06 100644
> > --- a/drivers/net/macvlan.c
> > +++ b/drivers/net/macvlan.c
> > @@ -422,6 +422,7 @@ static void macvlan_forward_source_one(struct sk_buff *skb,
> > return;
> >
> > len = nskb->len + ETH_HLEN;
> > + nf_reset_ct(nskb);
> > nskb->dev = dev;
> >
> > if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest, dev->dev_addr))
>
> [Severity: Low]
> Is b57dc7c13ea9 the right commit for the Fixes tag?
>
> That commit introduced net/sched/act_ct.c and did not touch
> drivers/net/macvlan.c. The clone that this patch resets is created in
> macvlan_forward_source_one(). That function came in with 79cf79abce71
> ("macvlan: add source mode"), and it has never dropped the clone's
> _nfct.
>
> The bridge path below does not depend on act_ct at all. Take a
> source-mode macvlan stacked on a bridge with br_netfilter enabled.
> Conntrack is attached at the bridge's prerouting hook. For a unicast
> PACKET_HOST frame, br_nf_local_in() then returns early:
>
> net/bridge/br_netfilter_hooks.c:br_nf_local_in() {
> ...
> if (!nfct || skb->pkt_type == PACKET_HOST)
> return NF_ACCEPT;
> ...
> }
>
> br_netif_receive_skb() then hands the skb to netif_receive_skb() on
> the bridge device. The unconfirmed _nfct is still attached, and the
> bridge device's rx_handler is macvlan_handle_frame(). From there,
> macvlan_forward_source_one() clones it just as in the act_ct case.
> The original and the clone then share the same unconfirmed nf_conn,
> with no tc involved.
>
> Stable tooling uses the Fixes tag to decide which trees get the
> backport. Pointing it at act_ct suggests the problem only exists
> once act_ct is present, and that does not seem to be the case.
> Should this be Fixes: 79cf79abce71 ("macvlan: add source mode")
> instead?
>
> [Severity: High]
> Can the broadcast/multicast RX path in this driver still hit the same
> double free?
>
> In macvlan_handle_frame(), a broadcast or multicast frame is cloned, and
> then the original keeps going up the lower device:
>
> drivers/net/macvlan.c:macvlan_handle_frame() {
> ...
> hash = mc_hash(NULL, eth->h_dest);
> if (test_bit(hash, port->bc_filter))
> macvlan_broadcast_enqueue(port, src, skb);
> else if (test_bit(hash, port->mc_filter))
> macvlan_multicast_rx(port, src, skb);
>
> return RX_HANDLER_PASS;
> ...
> }
>
> The broadcast address is always set in port->bc_filter (see
> macvlan_compute_filter()). macvlan_broadcast_enqueue() uses skb_clone(),
> and skb_clone() keeps _nfct.
>
> macvlan_process_broadcast() then handles the clone on the unbound
> system_dfl_wq. That worker can run on another CPU even without RPS.
>
> macvlan_process_broadcast()->macvlan_multicast_rx()->macvlan_broadcast()
> then clones once for each matching vlan:
>
> drivers/net/macvlan.c:macvlan_broadcast() {
> ...
> nskb = skb_clone(skb, GFP_ATOMIC);
> if (likely(nskb))
> err = macvlan_broadcast_one(nskb, vlan, eth,
> mode == MACVLAN_MODE_BRIDGE) ?:
> netif_rx(nskb);
> ...
> }
>
> On RX, mode is a mask such as MACVLAN_MODE_VEPA | MACVLAN_MODE_BRIDGE.
> That makes local false, so macvlan_broadcast_one() never calls
> __dev_forward_skb():
>
> drivers/net/macvlan.c:macvlan_broadcast_one() {
> ...
> if (local)
> return __dev_forward_skb(dev, skb);
>
> skb->dev = dev;
> ...
> }
>
> Each clone therefore reaches netif_rx() still pointing at the shared
> unconfirmed nf_conn.
>
> In prerouting, the original on the lower device and the clones on the
> macvlan devices can then call nf_ct_ext_add() on the same ct at the same
> time. One way in is nft "ct expectation" -> nf_ct_helper_ext_add(), which
> only requires !nf_ct_is_confirmed(ct). Both paths end up here:
>
> net/netfilter/nf_conntrack_extend.c:nf_ct_ext_add() {
> ...
> new = krealloc(ct->ext, alloc, gfp);
> ...
> }
>
> No lock is held there. This is the double free the commit message
> describes, reached with broadcast traffic instead of source mode.
>
> The commit message names __dev_forward_skb() as the model for this fix.
> However, only the local (TX bridge) branch of macvlan_broadcast_one() uses
> it.
>
> The later patch in this series, "macsec: drop the conntrack entry of
> delivered clones to fix a double free", only touches drivers/net/macsec.c.
> The macvlan broadcast path is therefore still unfixed at the end of the
> series.
>
> Could nf_reset_ct() also be called at one of these points?
>
> - on the clone in macvlan_broadcast_enqueue()
> - on each clone in macvlan_broadcast()
> - in macvlan_broadcast_one() when !local
>
> These clones also carry a conntrack entry owned by the lower device's
> netns into macvlan devices that may be in another netns.
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com