Commit 5a0bbce58bb25bd756f7ec437319d6ed2201a18b
Committed by
Al Viro
1 parent
4023e02080
Exists in
master
and in
39 other branches
[PATCH] sem2mutex: audit_netlink_sem
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 3 changed files with 13 additions and 12 deletions Side-by-side Diff
kernel/audit.c
... | ... | @@ -114,7 +114,7 @@ |
114 | 114 | /* The netlink socket is only to be read by 1 CPU, which lets us assume |
115 | 115 | * that list additions and deletions never happen simultaneously in |
116 | 116 | * auditsc.c */ |
117 | -DECLARE_MUTEX(audit_netlink_sem); | |
117 | +DEFINE_MUTEX(audit_netlink_mutex); | |
118 | 118 | |
119 | 119 | /* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting |
120 | 120 | * audit records. Since printk uses a 1024 byte buffer, this buffer |
121 | 121 | |
... | ... | @@ -538,14 +538,14 @@ |
538 | 538 | struct sk_buff *skb; |
539 | 539 | unsigned int qlen; |
540 | 540 | |
541 | - down(&audit_netlink_sem); | |
541 | + mutex_lock(&audit_netlink_mutex); | |
542 | 542 | |
543 | 543 | for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { |
544 | 544 | skb = skb_dequeue(&sk->sk_receive_queue); |
545 | 545 | audit_receive_skb(skb); |
546 | 546 | kfree_skb(skb); |
547 | 547 | } |
548 | - up(&audit_netlink_sem); | |
548 | + mutex_unlock(&audit_netlink_mutex); | |
549 | 549 | } |
550 | 550 | |
551 | 551 |
kernel/audit.h
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | 20 | */ |
21 | 21 | |
22 | +#include <linux/mutex.h> | |
22 | 23 | #include <linux/fs.h> |
23 | 24 | #include <linux/audit.h> |
24 | 25 | |
... | ... | @@ -84,5 +85,5 @@ |
84 | 85 | void *payload, int size); |
85 | 86 | extern void audit_log_lost(const char *message); |
86 | 87 | extern void audit_panic(const char *message); |
87 | -extern struct semaphore audit_netlink_sem; | |
88 | +extern struct mutex audit_netlink_mutex; |
kernel/auditfilter.c
... | ... | @@ -329,7 +329,7 @@ |
329 | 329 | } |
330 | 330 | |
331 | 331 | /* Add rule to given filterlist if not a duplicate. Protected by |
332 | - * audit_netlink_sem. */ | |
332 | + * audit_netlink_mutex. */ | |
333 | 333 | static inline int audit_add_rule(struct audit_entry *entry, |
334 | 334 | struct list_head *list) |
335 | 335 | { |
... | ... | @@ -352,7 +352,7 @@ |
352 | 352 | } |
353 | 353 | |
354 | 354 | /* Remove an existing rule from filterlist. Protected by |
355 | - * audit_netlink_sem. */ | |
355 | + * audit_netlink_mutex. */ | |
356 | 356 | static inline int audit_del_rule(struct audit_entry *entry, |
357 | 357 | struct list_head *list) |
358 | 358 | { |
359 | 359 | |
... | ... | @@ -383,10 +383,10 @@ |
383 | 383 | seq = dest[1]; |
384 | 384 | kfree(dest); |
385 | 385 | |
386 | - down(&audit_netlink_sem); | |
386 | + mutex_lock(&audit_netlink_mutex); | |
387 | 387 | |
388 | 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 | 390 | for (i=0; i<AUDIT_NR_FILTERS; i++) { |
391 | 391 | list_for_each_entry(entry, &audit_filter_list[i], list) { |
392 | 392 | struct audit_rule *rule; |
... | ... | @@ -401,7 +401,7 @@ |
401 | 401 | } |
402 | 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 | 405 | return 0; |
406 | 406 | } |
407 | 407 | |
408 | 408 | |
... | ... | @@ -417,10 +417,10 @@ |
417 | 417 | seq = dest[1]; |
418 | 418 | kfree(dest); |
419 | 419 | |
420 | - down(&audit_netlink_sem); | |
420 | + mutex_lock(&audit_netlink_mutex); | |
421 | 421 | |
422 | 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 | 424 | for (i=0; i<AUDIT_NR_FILTERS; i++) { |
425 | 425 | list_for_each_entry(e, &audit_filter_list[i], list) { |
426 | 426 | struct audit_rule_data *data; |
... | ... | @@ -435,7 +435,7 @@ |
435 | 435 | } |
436 | 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 | 439 | return 0; |
440 | 440 | } |
441 | 441 |