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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174265459205.356712.8546283286984099636.stgit@pro.pro>
Date: Sat, 22 Mar 2025 17:43:12 +0300
From: Kirill Tkhai <tkhai@...ru>
To: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: tkhai@...ru
Subject: [PATCH NET-PREV 43/51] net: Now check nobody calls netdev_master_upper_dev_link() without nd_lock attached

... or with devices not related to the same nd_lock,

since at this moment all callers are switched to follow this way.

Signed-off-by: Kirill Tkhai <tkhai@...ru>
---
 net/core/dev.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 1c447446215d..55df8157bca9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8126,6 +8126,12 @@ int netdev_master_upper_dev_link(struct net_device *dev,
 		.flags = NESTED_SYNC_IMM | NESTED_SYNC_TODO,
 		.data = NULL,
 	};
+	struct nd_lock *nd_lock;
+
+	nd_lock = rcu_dereference_protected(upper_dev->nd_lock, true);
+	if (WARN_ON(!mutex_is_locked(&nd_lock->mutex) ||
+		    nd_lock != rcu_dereference_protected(dev->nd_lock, true)))
+		return -EXDEV;
 
 	return __netdev_upper_dev_link(dev, upper_dev, true,
 				       upper_priv, upper_info, &priv, extack);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ