aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditfilter.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-02-03 20:25:33 -0500
committerEric W. Biederman <ebiederm@xmission.com>2014-02-28 07:04:33 -0500
commit48095d991d85687569ac025b18a6c7ae1632c9f7 (patch)
treef26908756c405000b301410ab2294ad7d69ca300 /kernel/auditfilter.c
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
audit: Use struct net not pid_t to remember the network namespce to reply in
In struct audit_netlink_list and audit_reply add a reference to the network namespace of the caller and remove the userspace pid of the caller. This cleanly remembers the callers network namespace, and removes a huge class of races and nasty failure modes that can occur when attempting to relook up the callers network namespace from a pid_t (including the caller's network namespace changing, pid wraparound, and the pid simply not being present). Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'kernel/auditfilter.c')
-rw-r--r--kernel/auditfilter.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 14a78cca384e..a5e3d73d73e4 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -29,6 +29,7 @@
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/security.h> 31#include <linux/security.h>
32#include <net/net_namespace.h>
32#include "audit.h" 33#include "audit.h"
33 34
34/* 35/*
@@ -1083,8 +1084,8 @@ int audit_list_rules_send(__u32 portid, int seq)
1083 dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); 1084 dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL);
1084 if (!dest) 1085 if (!dest)
1085 return -ENOMEM; 1086 return -ENOMEM;
1087 dest->net = get_net(current->nsproxy->net_ns);
1086 dest->portid = portid; 1088 dest->portid = portid;
1087 dest->pid = task_pid_vnr(current);
1088 skb_queue_head_init(&dest->q); 1089 skb_queue_head_init(&dest->q);
1089 1090
1090 mutex_lock(&audit_filter_mutex); 1091 mutex_lock(&audit_filter_mutex);