diff options
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index eb0f9165b401..6977ea57a7e2 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -664,11 +664,11 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
664 | if (sid) { | 664 | if (sid) { |
665 | if (selinux_sid_to_string( | 665 | if (selinux_sid_to_string( |
666 | sid, &ctx, &len)) { | 666 | sid, &ctx, &len)) { |
667 | audit_log_format(ab, | 667 | audit_log_format(ab, |
668 | " ssid=%u", sid); | 668 | " ssid=%u", sid); |
669 | /* Maybe call audit_panic? */ | 669 | /* Maybe call audit_panic? */ |
670 | } else | 670 | } else |
671 | audit_log_format(ab, | 671 | audit_log_format(ab, |
672 | " subj=%s", ctx); | 672 | " subj=%s", ctx); |
673 | kfree(ctx); | 673 | kfree(ctx); |
674 | } | 674 | } |
@@ -769,7 +769,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
769 | sig_data->pid = audit_sig_pid; | 769 | sig_data->pid = audit_sig_pid; |
770 | memcpy(sig_data->ctx, ctx, len); | 770 | memcpy(sig_data->ctx, ctx, len); |
771 | kfree(ctx); | 771 | kfree(ctx); |
772 | audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO, | 772 | audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO, |
773 | 0, 0, sig_data, sizeof(*sig_data) + len); | 773 | 0, 0, sig_data, sizeof(*sig_data) + len); |
774 | kfree(sig_data); | 774 | kfree(sig_data); |
775 | break; | 775 | break; |
@@ -847,18 +847,10 @@ static void audit_receive_skb(struct sk_buff *skb) | |||
847 | } | 847 | } |
848 | 848 | ||
849 | /* Receive messages from netlink socket. */ | 849 | /* Receive messages from netlink socket. */ |
850 | static void audit_receive(struct sock *sk, int length) | 850 | static void audit_receive(struct sk_buff *skb) |
851 | { | 851 | { |
852 | struct sk_buff *skb; | ||
853 | unsigned int qlen; | ||
854 | |||
855 | mutex_lock(&audit_cmd_mutex); | 852 | mutex_lock(&audit_cmd_mutex); |
856 | 853 | audit_receive_skb(skb); | |
857 | for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { | ||
858 | skb = skb_dequeue(&sk->sk_receive_queue); | ||
859 | audit_receive_skb(skb); | ||
860 | kfree_skb(skb); | ||
861 | } | ||
862 | mutex_unlock(&audit_cmd_mutex); | 854 | mutex_unlock(&audit_cmd_mutex); |
863 | } | 855 | } |
864 | 856 | ||
@@ -876,8 +868,8 @@ static int __init audit_init(void) | |||
876 | 868 | ||
877 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", | 869 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", |
878 | audit_default ? "enabled" : "disabled"); | 870 | audit_default ? "enabled" : "disabled"); |
879 | audit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive, | 871 | audit_sock = netlink_kernel_create(&init_net, NETLINK_AUDIT, 0, |
880 | NULL, THIS_MODULE); | 872 | audit_receive, NULL, THIS_MODULE); |
881 | if (!audit_sock) | 873 | if (!audit_sock) |
882 | audit_panic("cannot initialize netlink socket"); | 874 | audit_panic("cannot initialize netlink socket"); |
883 | else | 875 | else |
@@ -1013,7 +1005,7 @@ unsigned int audit_serial(void) | |||
1013 | return ret; | 1005 | return ret; |
1014 | } | 1006 | } |
1015 | 1007 | ||
1016 | static inline void audit_get_stamp(struct audit_context *ctx, | 1008 | static inline void audit_get_stamp(struct audit_context *ctx, |
1017 | struct timespec *t, unsigned int *serial) | 1009 | struct timespec *t, unsigned int *serial) |
1018 | { | 1010 | { |
1019 | if (ctx) | 1011 | if (ctx) |
@@ -1064,7 +1056,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, | |||
1064 | if (gfp_mask & __GFP_WAIT) | 1056 | if (gfp_mask & __GFP_WAIT) |
1065 | reserve = 0; | 1057 | reserve = 0; |
1066 | else | 1058 | else |
1067 | reserve = 5; /* Allow atomic callers to go up to five | 1059 | reserve = 5; /* Allow atomic callers to go up to five |
1068 | entries over the normal backlog limit */ | 1060 | entries over the normal backlog limit */ |
1069 | 1061 | ||
1070 | while (audit_backlog_limit | 1062 | while (audit_backlog_limit |
@@ -1327,7 +1319,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix, | |||
1327 | if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ | 1319 | if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ |
1328 | /* FIXME: can we save some information here? */ | 1320 | /* FIXME: can we save some information here? */ |
1329 | audit_log_format(ab, "<too long>"); | 1321 | audit_log_format(ab, "<too long>"); |
1330 | } else | 1322 | } else |
1331 | audit_log_untrustedstring(ab, p); | 1323 | audit_log_untrustedstring(ab, p); |
1332 | kfree(path); | 1324 | kfree(path); |
1333 | } | 1325 | } |
@@ -1373,7 +1365,7 @@ void audit_log_end(struct audit_buffer *ab) | |||
1373 | * audit_log_vformat, and audit_log_end. It may be called | 1365 | * audit_log_vformat, and audit_log_end. It may be called |
1374 | * in any context. | 1366 | * in any context. |
1375 | */ | 1367 | */ |
1376 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, | 1368 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, |
1377 | const char *fmt, ...) | 1369 | const char *fmt, ...) |
1378 | { | 1370 | { |
1379 | struct audit_buffer *ab; | 1371 | struct audit_buffer *ab; |