net: reject ops-locked drivers without ndo_set_rx_mode_async

ndo_set_rx_mode cannot sleep and runs with netif_addr_lock_bh held, so an
ops-locked driver cannot take the instance lock from it.
ndo_set_rx_mode_async is the replacement and runs in process context.

Registration has only warned about this since v7.1, long enough to find
the offenders. Make it an error.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20261002094211.2350702-3-nb@tipi-net.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Nicolai Buchwitz 2026-10-02 11:42:08 +02:00 committed by Jakub Kicinski
parent 57f66330c6
commit 05fe748456

View File

@ -11463,8 +11463,10 @@ static int netdev_check_ops(struct net_device *dev)
}
if (netdev_need_ops_lock(dev) && ops->ndo_set_rx_mode &&
!ops->ndo_set_rx_mode_async)
!ops->ndo_set_rx_mode_async) {
netdev_WARN(dev, "ops-locked drivers should use ndo_set_rx_mode_async\n");
return -EINVAL;
}
return 0;
}