diff options
-rw-r--r-- | kernel/audit.c | 10 | ||||
-rw-r--r-- | kernel/audit.h | 2 | ||||
-rw-r--r-- | kernel/auditfilter.c | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 34c5a2310fbf..1e5756f16f6f 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -182,7 +182,7 @@ struct audit_buffer { | |||
182 | 182 | ||
183 | struct audit_reply { | 183 | struct audit_reply { |
184 | __u32 portid; | 184 | __u32 portid; |
185 | pid_t pid; | 185 | struct net *net; |
186 | struct sk_buff *skb; | 186 | struct sk_buff *skb; |
187 | }; | 187 | }; |
188 | 188 | ||
@@ -500,7 +500,7 @@ int audit_send_list(void *_dest) | |||
500 | { | 500 | { |
501 | struct audit_netlink_list *dest = _dest; | 501 | struct audit_netlink_list *dest = _dest; |
502 | struct sk_buff *skb; | 502 | struct sk_buff *skb; |
503 | struct net *net = get_net_ns_by_pid(dest->pid); | 503 | struct net *net = dest->net; |
504 | struct audit_net *aunet = net_generic(net, audit_net_id); | 504 | struct audit_net *aunet = net_generic(net, audit_net_id); |
505 | 505 | ||
506 | /* wait for parent to finish and send an ACK */ | 506 | /* wait for parent to finish and send an ACK */ |
@@ -510,6 +510,7 @@ int audit_send_list(void *_dest) | |||
510 | while ((skb = __skb_dequeue(&dest->q)) != NULL) | 510 | while ((skb = __skb_dequeue(&dest->q)) != NULL) |
511 | netlink_unicast(aunet->nlsk, skb, dest->portid, 0); | 511 | netlink_unicast(aunet->nlsk, skb, dest->portid, 0); |
512 | 512 | ||
513 | put_net(net); | ||
513 | kfree(dest); | 514 | kfree(dest); |
514 | 515 | ||
515 | return 0; | 516 | return 0; |
@@ -543,7 +544,7 @@ out_kfree_skb: | |||
543 | static int audit_send_reply_thread(void *arg) | 544 | static int audit_send_reply_thread(void *arg) |
544 | { | 545 | { |
545 | struct audit_reply *reply = (struct audit_reply *)arg; | 546 | struct audit_reply *reply = (struct audit_reply *)arg; |
546 | struct net *net = get_net_ns_by_pid(reply->pid); | 547 | struct net *net = reply->net; |
547 | struct audit_net *aunet = net_generic(net, audit_net_id); | 548 | struct audit_net *aunet = net_generic(net, audit_net_id); |
548 | 549 | ||
549 | mutex_lock(&audit_cmd_mutex); | 550 | mutex_lock(&audit_cmd_mutex); |
@@ -552,6 +553,7 @@ static int audit_send_reply_thread(void *arg) | |||
552 | /* Ignore failure. It'll only happen if the sender goes away, | 553 | /* Ignore failure. It'll only happen if the sender goes away, |
553 | because our timeout is set to infinite. */ | 554 | because our timeout is set to infinite. */ |
554 | netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); | 555 | netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); |
556 | put_net(net); | ||
555 | kfree(reply); | 557 | kfree(reply); |
556 | return 0; | 558 | return 0; |
557 | } | 559 | } |
@@ -583,8 +585,8 @@ static void audit_send_reply(__u32 portid, int seq, int type, int done, | |||
583 | if (!skb) | 585 | if (!skb) |
584 | goto out; | 586 | goto out; |
585 | 587 | ||
588 | reply->net = get_net(current->nsproxy->net_ns); | ||
586 | reply->portid = portid; | 589 | reply->portid = portid; |
587 | reply->pid = task_pid_vnr(current); | ||
588 | reply->skb = skb; | 590 | reply->skb = skb; |
589 | 591 | ||
590 | tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); | 592 | tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); |
diff --git a/kernel/audit.h b/kernel/audit.h index 57cc64d67718..8df132214606 100644 --- a/kernel/audit.h +++ b/kernel/audit.h | |||
@@ -247,7 +247,7 @@ extern void audit_panic(const char *message); | |||
247 | 247 | ||
248 | struct audit_netlink_list { | 248 | struct audit_netlink_list { |
249 | __u32 portid; | 249 | __u32 portid; |
250 | pid_t pid; | 250 | struct net *net; |
251 | struct sk_buff_head q; | 251 | struct sk_buff_head q; |
252 | }; | 252 | }; |
253 | 253 | ||
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); |