Unverified Commit f12021e6 authored by Christian Brauner's avatar Christian Brauner
Browse files

ipv4: use check_net()



Don't directly acess the namespace count. There's even a dedicated
helper for this.

Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent dc41b844
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -329,13 +329,13 @@ void inet_twsk_purge(struct inet_hashinfo *hashinfo)
					     TCPF_NEW_SYN_RECV))
				continue;

			if (refcount_read(&sock_net(sk)->ns.count))
			if (check_net(sock_net(sk)))
				continue;

			if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt)))
				continue;

			if (refcount_read(&sock_net(sk)->ns.count)) {
			if (check_net(sock_net(sk))) {
				sock_gen_put(sk);
				goto restart;
			}
+1 −1
Original line number Diff line number Diff line
@@ -912,7 +912,7 @@ static void tcp_metrics_flush_all(struct net *net)
		spin_lock_bh(&tcp_metrics_lock);
		for (tm = deref_locked(*pp); tm; tm = deref_locked(*pp)) {
			match = net ? net_eq(tm_net(tm), net) :
				!refcount_read(&tm_net(tm)->ns.count);
				!check_net(tm_net(tm));
			if (match) {
				rcu_assign_pointer(*pp, tm->tcpm_next);
				kfree_rcu(tm, rcu_head);