diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2025-03-24 15:45:31 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-03-25 10:06:49 -0700 |
| commit | 0a65dcf6249b75c841b4218426b0d246a805c7e0 (patch) | |
| tree | 11501e3fe35fdf79950fc41e3f0b5529df61a845 /net/core/netdev-genl.c | |
| parent | 4b702f8b72c7b05daa1b763fdc0840aa78178c3a (diff) | |
net: designate queue counts as "double ops protected" by instance lock
Drivers which opt into instance lock protection of ops should
only call set_real_num_*_queues() under the instance lock.
This means that queue counts are double protected (writes
are under both rtnl_lock and instance lock, readers under
either).
Some readers may still be under the rtnl_lock, however, so for
now we need double protection of writers.
OTOH queue API paths are only under the protection of the instance
lock, so we need to validate that the instance is actually locking
ops, otherwise the input checks we do against queue count are racy.
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250324224537.248800-6-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/netdev-genl.c')
| -rw-r--r-- | net/core/netdev-genl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 9e4882a22407..fd1cfa9707dc 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -867,6 +867,13 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) goto err_unlock_sock; } + if (!netdev_need_ops_lock(netdev)) { + err = -EOPNOTSUPP; + NL_SET_BAD_ATTR(info->extack, + info->attrs[NETDEV_A_DEV_IFINDEX]); + goto err_unlock; + } + if (dev_xdp_prog_count(netdev)) { NL_SET_ERR_MSG(info->extack, "unable to bind dmabuf to device with XDP program attached"); err = -EEXIST; |