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-next>] [day] [month] [year] [list]
Date: Wed, 17 Jan 2024 16:37:13 +0800
From: nai lin <ayano2023th@...il.com>
To: netdev@...r.kernel.org
Cc: nai lin <ayano2023th@...il.com>,
	"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>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Anjali Kulkarni <anjali.k.kulkarni@...cle.com>,
	Li RongQing <lirongqing@...du.com>,
	David Howells <dhowells@...hat.com>,
	Kuniyuki Iwashima <kuniyu@...zon.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] netlink: fix potential race issue in netlink_native_seq_show()

Access to the nlk group should be protected by netlink_lock_table() like
commit <f773608026ee> ("netlink: access nlk groups safely in netlink bind
and getname"), otherwise there will be potential race conditions.

Signed-off-by: nai lin <ayano2023th@...il.com>
---
 net/netlink/af_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 4ed8ffd58ff3..61ad81fb80f5 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2693,6 +2693,7 @@ static int netlink_native_seq_show(struct seq_file *seq, void *v)
 		struct sock *s = v;
 		struct netlink_sock *nlk = nlk_sk(s);
 
+		netlink_lock_table();
 		seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n",
 			   s,
 			   s->sk_protocol,
@@ -2705,7 +2706,7 @@ static int netlink_native_seq_show(struct seq_file *seq, void *v)
 			   atomic_read(&s->sk_drops),
 			   sock_i_ino(s)
 			);
-
+		netlink_unlock_table();
 	}
 	return 0;
 }
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ