diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 6 | ||||
-rw-r--r-- | kernel/audit.h | 3 | ||||
-rw-r--r-- | kernel/auditfilter.c | 16 |
3 files changed, 13 insertions, 12 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 4eb97b62d7fa..6a44e0a7707d 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -114,7 +114,7 @@ static DECLARE_WAIT_QUEUE_HEAD(audit_backlog_wait); | |||
114 | /* The netlink socket is only to be read by 1 CPU, which lets us assume | 114 | /* The netlink socket is only to be read by 1 CPU, which lets us assume |
115 | * that list additions and deletions never happen simultaneously in | 115 | * that list additions and deletions never happen simultaneously in |
116 | * auditsc.c */ | 116 | * auditsc.c */ |
117 | DECLARE_MUTEX(audit_netlink_sem); | 117 | DEFINE_MUTEX(audit_netlink_mutex); |
118 | 118 | ||
119 | /* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting | 119 | /* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting |
120 | * audit records. Since printk uses a 1024 byte buffer, this buffer | 120 | * audit records. Since printk uses a 1024 byte buffer, this buffer |
@@ -538,14 +538,14 @@ static void audit_receive(struct sock *sk, int length) | |||
538 | struct sk_buff *skb; | 538 | struct sk_buff *skb; |
539 | unsigned int qlen; | 539 | unsigned int qlen; |
540 | 540 | ||
541 | down(&audit_netlink_sem); | 541 | mutex_lock(&audit_netlink_mutex); |
542 | 542 | ||
543 | for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { | 543 | for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { |
544 | skb = skb_dequeue(&sk->sk_receive_queue); | 544 | skb = skb_dequeue(&sk->sk_receive_queue); |
545 | audit_receive_skb(skb); | 545 | audit_receive_skb(skb); |
546 | kfree_skb(skb); | 546 | kfree_skb(skb); |
547 | } | 547 | } |
548 | up(&audit_netlink_sem); | 548 | mutex_unlock(&audit_netlink_mutex); |
549 | } | 549 | } |
550 | 550 | ||
551 | 551 | ||
diff --git a/kernel/audit.h b/kernel/audit.h index 4b602cdcabef..bc5392076e2b 100644 --- a/kernel/audit.h +++ b/kernel/audit.h | |||
@@ -19,6 +19,7 @@ | |||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/mutex.h> | ||
22 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
23 | #include <linux/audit.h> | 24 | #include <linux/audit.h> |
24 | 25 | ||
@@ -84,4 +85,4 @@ extern void audit_send_reply(int pid, int seq, int type, | |||
84 | void *payload, int size); | 85 | void *payload, int size); |
85 | extern void audit_log_lost(const char *message); | 86 | extern void audit_log_lost(const char *message); |
86 | extern void audit_panic(const char *message); | 87 | extern void audit_panic(const char *message); |
87 | extern struct semaphore audit_netlink_sem; | 88 | extern struct mutex audit_netlink_mutex; |
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index b85fd8cce11f..d3a8539f3a83 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -329,7 +329,7 @@ static int audit_compare_rule(struct audit_krule *a, struct audit_krule *b) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | /* Add rule to given filterlist if not a duplicate. Protected by | 331 | /* Add rule to given filterlist if not a duplicate. Protected by |
332 | * audit_netlink_sem. */ | 332 | * audit_netlink_mutex. */ |
333 | static inline int audit_add_rule(struct audit_entry *entry, | 333 | static inline int audit_add_rule(struct audit_entry *entry, |
334 | struct list_head *list) | 334 | struct list_head *list) |
335 | { | 335 | { |
@@ -352,7 +352,7 @@ static inline int audit_add_rule(struct audit_entry *entry, | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /* Remove an existing rule from filterlist. Protected by | 354 | /* Remove an existing rule from filterlist. Protected by |
355 | * audit_netlink_sem. */ | 355 | * audit_netlink_mutex. */ |
356 | static inline int audit_del_rule(struct audit_entry *entry, | 356 | static inline int audit_del_rule(struct audit_entry *entry, |
357 | struct list_head *list) | 357 | struct list_head *list) |
358 | { | 358 | { |
@@ -383,10 +383,10 @@ static int audit_list(void *_dest) | |||
383 | seq = dest[1]; | 383 | seq = dest[1]; |
384 | kfree(dest); | 384 | kfree(dest); |
385 | 385 | ||
386 | down(&audit_netlink_sem); | 386 | mutex_lock(&audit_netlink_mutex); |
387 | 387 | ||
388 | /* The *_rcu iterators not needed here because we are | 388 | /* The *_rcu iterators not needed here because we are |
389 | always called with audit_netlink_sem held. */ | 389 | always called with audit_netlink_mutex held. */ |
390 | for (i=0; i<AUDIT_NR_FILTERS; i++) { | 390 | for (i=0; i<AUDIT_NR_FILTERS; i++) { |
391 | list_for_each_entry(entry, &audit_filter_list[i], list) { | 391 | list_for_each_entry(entry, &audit_filter_list[i], list) { |
392 | struct audit_rule *rule; | 392 | struct audit_rule *rule; |
@@ -401,7 +401,7 @@ static int audit_list(void *_dest) | |||
401 | } | 401 | } |
402 | audit_send_reply(pid, seq, AUDIT_LIST, 1, 1, NULL, 0); | 402 | audit_send_reply(pid, seq, AUDIT_LIST, 1, 1, NULL, 0); |
403 | 403 | ||
404 | up(&audit_netlink_sem); | 404 | mutex_unlock(&audit_netlink_mutex); |
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
407 | 407 | ||
@@ -417,10 +417,10 @@ static int audit_list_rules(void *_dest) | |||
417 | seq = dest[1]; | 417 | seq = dest[1]; |
418 | kfree(dest); | 418 | kfree(dest); |
419 | 419 | ||
420 | down(&audit_netlink_sem); | 420 | mutex_lock(&audit_netlink_mutex); |
421 | 421 | ||
422 | /* The *_rcu iterators not needed here because we are | 422 | /* The *_rcu iterators not needed here because we are |
423 | always called with audit_netlink_sem held. */ | 423 | always called with audit_netlink_mutex held. */ |
424 | for (i=0; i<AUDIT_NR_FILTERS; i++) { | 424 | for (i=0; i<AUDIT_NR_FILTERS; i++) { |
425 | list_for_each_entry(e, &audit_filter_list[i], list) { | 425 | list_for_each_entry(e, &audit_filter_list[i], list) { |
426 | struct audit_rule_data *data; | 426 | struct audit_rule_data *data; |
@@ -435,7 +435,7 @@ static int audit_list_rules(void *_dest) | |||
435 | } | 435 | } |
436 | audit_send_reply(pid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0); | 436 | audit_send_reply(pid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0); |
437 | 437 | ||
438 | up(&audit_netlink_sem); | 438 | mutex_unlock(&audit_netlink_mutex); |
439 | return 0; | 439 | return 0; |
440 | } | 440 | } |
441 | 441 | ||