lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250111065955.3698801-2-kuba@kernel.org>
Date: Fri, 10 Jan 2025 22:59:55 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
	edumazet@...gle.com,
	pabeni@...hat.com,
	andrew+netdev@...n.ch,
	horms@...nel.org,
	Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net-next 2/2] net: initialize netdev->lock on dummy devices

Make sure netdev->lock is always valid, even on dummy netdevs.

Apparently it's legal to call mutex_destroy() on an uninitialized
mutex (and we do that in free_netdev()), but it doesn't seem right.
Plus we'll soon want to take netdev->lock on more paths which dummy
netdevs may reach.

Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 23e7f6a3925b..00552197d601 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10756,6 +10756,8 @@ static void init_dummy_netdev_core(struct net_device *dev)
 	/* napi_busy_loop stats accounting wants this */
 	dev_net_set(dev, &init_net);
 
+	mutex_init(&dev->lock);
+
 	/* Note : We dont allocate pcpu_refcnt for dummy devices,
 	 * because users of this 'device' dont need to change
 	 * its refcount.
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ