aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditfilter.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-02-28 22:44:55 -0500
committerEric W. Biederman <ebiederm@xmission.com>2014-02-28 22:44:55 -0500
commit6f285b19d09f72e801525f5eea1bdad22e559bf0 (patch)
treeece90969f72ebf9b06b0386762b35cb20e415dd4 /kernel/auditfilter.c
parent48095d991d85687569ac025b18a6c7ae1632c9f7 (diff)
audit: Send replies in the proper network namespace.
In perverse cases of file descriptor passing the current network namespace of a process and the network namespace of a socket used by that socket may differ. Therefore use the network namespace of the appropiate socket to ensure replies always go to the appropiate socket. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'kernel/auditfilter.c')
-rw-r--r--kernel/auditfilter.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index a5e3d73d73e4..e8d1c7c515d7 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -30,6 +30,7 @@
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 <net/net_namespace.h>
33#include <net/sock.h>
33#include "audit.h" 34#include "audit.h"
34 35
35/* 36/*
@@ -1069,8 +1070,10 @@ int audit_rule_change(int type, __u32 portid, int seq, void *data,
1069 * @portid: target portid for netlink audit messages 1070 * @portid: target portid for netlink audit messages
1070 * @seq: netlink audit message sequence (serial) number 1071 * @seq: netlink audit message sequence (serial) number
1071 */ 1072 */
1072int audit_list_rules_send(__u32 portid, int seq) 1073int audit_list_rules_send(struct sk_buff *request_skb, int seq)
1073{ 1074{
1075 u32 portid = NETLINK_CB(request_skb).portid;
1076 struct net *net = sock_net(NETLINK_CB(request_skb).sk);
1074 struct task_struct *tsk; 1077 struct task_struct *tsk;
1075 struct audit_netlink_list *dest; 1078 struct audit_netlink_list *dest;
1076 int err = 0; 1079 int err = 0;
@@ -1084,7 +1087,7 @@ int audit_list_rules_send(__u32 portid, int seq)
1084 dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); 1087 dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL);
1085 if (!dest) 1088 if (!dest)
1086 return -ENOMEM; 1089 return -ENOMEM;
1087 dest->net = get_net(current->nsproxy->net_ns); 1090 dest->net = get_net(net);
1088 dest->portid = portid; 1091 dest->portid = portid;
1089 skb_queue_head_init(&dest->q); 1092 skb_queue_head_init(&dest->q);
1090 1093