Skip to content

Commit

Permalink
net: xdp: don't call notifiers during driver init
Browse files Browse the repository at this point in the history
Drivers will commonly perform feature setting during init, if they use
the xdp_set_features_flag() helper they'll likely run into an ASSERT_RTNL()
inside call_netdevice_notifiers_info().

Don't call the notifier until the device is actually registered.
Nothing should be tracking the device until its registered and
after its unregistration has started.

Fixes: 4d5ab0a ("net/mlx5e: take into account device reconfiguration for xdp_features flag")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Mar 17, 2023
1 parent 85578fe commit 769639c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/core/xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,9 @@ void xdp_set_features_flag(struct net_device *dev, xdp_features_t val)
return;

dev->xdp_features = val;
call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);

if (dev->reg_state == NETREG_REGISTERED)
call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
}
EXPORT_SYMBOL_GPL(xdp_set_features_flag);

Expand Down

0 comments on commit 769639c

Please sign in to comment.