@@ -901,7 +901,7 @@ int audit_send_list_thread(void *_dest)
while ((skb = __skb_dequeue(&dest->q)) != NULL)
netlink_unicast(sk, skb, dest->portid, 0);
- put_net(dest->net);
+ put_net_track(dest->net, &dest->ns_tracker);
kfree(dest);
return 0;
@@ -15,6 +15,7 @@
#include <uapi/linux/mqueue.h>
#include <linux/tty.h>
#include <uapi/linux/openat2.h> // struct open_how
+#include <net/net_trackers.h>
/* AUDIT_NAMES is the number of slots we reserve in the audit_context
* for saving names from getname(). If we get more names we will allocate
@@ -236,6 +237,7 @@ extern void audit_panic(const char *message);
struct audit_netlink_list {
__u32 portid;
struct net *net;
+ netns_tracker ns_tracker;
struct sk_buff_head q;
};
@@ -1182,7 +1182,8 @@ int audit_list_rules_send(struct sk_buff *request_skb, int seq)
dest = kmalloc(sizeof(*dest), GFP_KERNEL);
if (!dest)
return -ENOMEM;
- dest->net = get_net(sock_net(NETLINK_CB(request_skb).sk));
+ dest->net = get_net_track(sock_net(NETLINK_CB(request_skb).sk),
+ &dest->ns_tracker, GFP_KERNEL);
dest->portid = NETLINK_CB(request_skb).portid;
skb_queue_head_init(&dest->q);