On Tue, 17 Nov 2026 16:39:48 -0800 Kameron Carr wrote:
> > -   if (netvsc_vf_join(vf_netdev, ndev, context) != 0)
> > +   if (netvsc_vf_join(vf_netdev, ndev, context) != 0) {
> > +           ret = prog ? netvsc_vf_setxdp(vf_netdev, NULL) : 0;
> > +           if (ret)
> > +                   netdev_warn(ndev, "failed to remove XDP program from VF 
> > %s: %d\n",
> > +                               vf_netdev->name, ret);
> >             return NOTIFY_DONE;
> > +   }  
> 
> If netvsc_vf_join() fails here, did we potentially just
> netdev_update_features() a VF we don't own? Can we restore the old
> features on failure? And / or reject VFs with a busy RX handler before
> making feature changes?

To me the first question is why this driver thinks its appropriate
to override wanted_features in the first place??  That's not how
normal feature propagation works for uppers.

Slightly more to your point - I don't see the driver restoring the
original features when VF detaches. So why should we bother worrying
about the failure case when normal detach doesn't clean up?

> >     dev_hold(vf_netdev);
> >     rcu_assign_pointer(net_device_ctx->vf_netdev, vf_netdev);
> > @@ -2363,9 +2391,6 @@ static int netvsc_register_vf(struct net_device 
> > *vf_netdev, int context)
> >     vf_netdev->wanted_features = ndev->features;
> >     netdev_update_features(vf_netdev);
> >  
> > -   prog = netvsc_xdp_get(netvsc_dev);
> > -   netvsc_vf_setxdp(vf_netdev, prog);  
> 
> I think Sashiko has a point that this patch might introduce edge case
> issues when netvsc_detach() fails.
> 
> I wonder if moving the netvsc_xdp_set() after netif_device_detach() in
> netvsc_detach() fixes some of the faiure paths (RNDIS close or ring
> drain fails)? I haven't yet fully thought through all the scenarios
> Sashiko brought up.
> 
> I understand improving XDP accounting is the end goal, but I hope we can
> get there without introducing new bugs.

"Improving" is not strong enough, the propagation bypassed all safety
checks. See the next series in the sequence:
https://lore.kernel.org/all/[email protected]/
Pretty sure I left netvsc in a much better state that before the series,
but there's plenty of bugs left to fix. I hope Microsoft will address
them.

Reply via email to