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: <20211207005142.1688204-16-eric.dumazet@gmail.com>
Date:   Mon,  6 Dec 2021 16:51:40 -0800
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Cc:     netdev <netdev@...r.kernel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: [PATCH net-next 15/17] audit: add netns refcount tracker to struct audit_net

From: Eric Dumazet <edumazet@...gle.com>

Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
 kernel/audit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 121d37e700a62b53854c06199d9a89850ec39dd4..27013414847678af4283484feab2461e3d9c67ed 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -96,6 +96,7 @@ struct audit_net {
  * @pid: auditd PID
  * @portid: netlink portid
  * @net: the associated network namespace
+ * ns_tracker: tracker for @net reference
  * @rcu: RCU head
  *
  * Description:
@@ -106,6 +107,7 @@ struct auditd_connection {
 	struct pid *pid;
 	u32 portid;
 	struct net *net;
+	netns_tracker ns_tracker;
 	struct rcu_head rcu;
 };
 static struct auditd_connection __rcu *auditd_conn;
@@ -481,7 +483,7 @@ static void auditd_conn_free(struct rcu_head *rcu)
 
 	ac = container_of(rcu, struct auditd_connection, rcu);
 	put_pid(ac->pid);
-	put_net(ac->net);
+	put_net_track(ac->net, &ac->ns_tracker);
 	kfree(ac);
 }
 
@@ -508,7 +510,7 @@ static int auditd_set(struct pid *pid, u32 portid, struct net *net)
 		return -ENOMEM;
 	ac_new->pid = get_pid(pid);
 	ac_new->portid = portid;
-	ac_new->net = get_net(net);
+	ac_new->net = get_net_track(net, &ac_new->ns_tracker, GFP_KERNEL);
 
 	spin_lock_irqsave(&auditd_conn_lock, flags);
 	ac_old = rcu_dereference_protected(auditd_conn,
-- 
2.34.1.400.ga245620fadb-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ