summaryrefslogtreecommitdiff
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-01-14 19:53:16 -0800
committerJakub Kicinski <kuba@kernel.org>2025-01-15 19:13:34 -0800
commit1bb86cf8f44b1c1a320566558250b1f5121f6fd3 (patch)
treeb37b1e25e9a09d845fdafeb292e12cde579a6a48 /net/core/dev.c
parenteeeec1d4c6930691fc59858799b8a7443d9d30ee (diff)
net: protect threaded status of NAPI with netdev_lock()
Now that NAPI instances can't come and go without holding netdev->lock we can trivially switch from rtnl_lock() to netdev_lock() for setting netdev->threaded via sysfs. Note that since we do not lock netdev_lock around sysfs calls in the core we don't have to "trylock" like we do with rtnl_lock. Reviewed-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250115035319.559603-9-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 2ef50a3ee4a1..34db90f345d5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6785,6 +6785,8 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
struct napi_struct *napi;
int err = 0;
+ netdev_assert_locked_or_invisible(dev);
+
if (dev->threaded == threaded)
return 0;