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] [day] [month] [year] [list]
Message-Id: <20241113-netcon_cpu-v1-1-d187bf7c0321@debian.org>
Date: Wed, 13 Nov 2024 07:10:52 -0800
From: Breno Leitao <leitao@...ian.org>
To: Andrew Lunn <andrew+netdev@...n.ch>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
 Simon Horman <horms@...nel.org>, Jonathan Corbet <corbet@....net>, 
 Shuah Khan <shuah@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
 linux-doc@...r.kernel.org, linux-kselftest@...r.kernel.org, 
 Breno Leitao <leitao@...ian.org>, max@...sevol.com, thepacketgeek@...il.com, 
 vlad.wing@...il.com, davej@...emonkey.org.uk
Subject: [PATCH net-next 1/4] netconsole: Ensure dynamic_netconsole_mutex
 is held during userdata update

Add a lock assertion to verify that dynamic_netconsole_mutex is held
when updating the userdata fields in the netconsole driver.

This change prevents calling update_userdata() without holding the lock,
ensuring data consistency and integrity.

The update_userdata() function is invoked only when the user changes the
configuration, so this addition does not impact performance as it is not
in the hot path.

Signed-off-by: Breno Leitao <leitao@...ian.org>
---
 drivers/net/netconsole.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 4ea44a2f48f7b1f9059d275f0f0edc40cc1997f0..965712d65a014c60f91bf35e48f1b112f66b8439 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -697,6 +697,8 @@ static void update_userdata(struct netconsole_target *nt)
 	int complete_idx = 0, child_count = 0;
 	struct list_head *entry;
 
+	lockdep_assert_held(&dynamic_netconsole_mutex);
+
 	/* Clear the current string in case the last userdatum was deleted */
 	nt->userdata_length = 0;
 	nt->userdata_complete[0] = 0;

-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ