Skip to content

Commit 769639c

Browse files
committed
net: xdp: don't call notifiers during driver init
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]>
1 parent 85578fe commit 769639c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/core/xdp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,9 @@ void xdp_set_features_flag(struct net_device *dev, xdp_features_t val)
781781
return;
782782

783783
dev->xdp_features = val;
784-
call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
784+
785+
if (dev->reg_state == NETREG_REGISTERED)
786+
call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
785787
}
786788
EXPORT_SYMBOL_GPL(xdp_set_features_flag);
787789

0 commit comments

Comments
 (0)