]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: designate queue counts as "double ops protected" by instance lock
authorJakub Kicinski <kuba@kernel.org>
Mon, 24 Mar 2025 22:45:31 +0000 (15:45 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 25 Mar 2025 17:06:49 +0000 (10:06 -0700)
commit0a65dcf6249b75c841b4218426b0d246a805c7e0
tree11501e3fe35fdf79950fc41e3f0b5529df61a845
parent4b702f8b72c7b05daa1b763fdc0840aa78178c3a
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>
include/linux/netdevice.h
net/core/dev.c
net/core/net-sysfs.c
net/core/netdev-genl.c
net/core/netdev_rx_queue.c