[PATCH net-next v2 2/3] net: reject ops-locked drivers without ndo_set_rx_mode_async

From: Nicolai Buchwitz

Date: Fri Oct 02 2026 - 05:47:12 EST


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@xxxxxxxxxx>
Signed-off-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>
---
I grepped for potential offenders in the tree using

for f in $(git grep -lE 'request_ops_lock|queue_mgmt_ops|net_shaper_ops' \
-- drivers/net); do
d=$(dirname $f)
git grep -q '\.ndo_set_rx_mode\s*=' -- $d &&
! git grep -q 'ndo_set_rx_mode_async' -- $d && echo "$d"
done

but haven't found any. net-next testing will show if I missed something.

net/core/dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index a44bcfc29d54..ca7f4844cc40 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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;
}
--
2.53.0