mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 08:31:13 +00:00
[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>
This commit is contained in:
parent
4023e02080
commit
5a0bbce58b
3 changed files with 13 additions and 12 deletions
|
@ -114,7 +114,7 @@ static DECLARE_WAIT_QUEUE_HEAD(audit_backlog_wait);
|
||||||
/* The netlink socket is only to be read by 1 CPU, which lets us assume
|
/* The netlink socket is only to be read by 1 CPU, which lets us assume
|
||||||
* that list additions and deletions never happen simultaneously in
|
* that list additions and deletions never happen simultaneously in
|
||||||
* auditsc.c */
|
* auditsc.c */
|
||||||
DECLARE_MUTEX(audit_netlink_sem);
|
DEFINE_MUTEX(audit_netlink_mutex);
|
||||||
|
|
||||||
/* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting
|
/* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting
|
||||||
* audit records. Since printk uses a 1024 byte buffer, this buffer
|
* audit records. Since printk uses a 1024 byte buffer, this buffer
|
||||||
|
@ -538,14 +538,14 @@ static void audit_receive(struct sock *sk, int length)
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
unsigned int qlen;
|
unsigned int qlen;
|
||||||
|
|
||||||
down(&audit_netlink_sem);
|
mutex_lock(&audit_netlink_mutex);
|
||||||
|
|
||||||
for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) {
|
for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) {
|
||||||
skb = skb_dequeue(&sk->sk_receive_queue);
|
skb = skb_dequeue(&sk->sk_receive_queue);
|
||||||
audit_receive_skb(skb);
|
audit_receive_skb(skb);
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
}
|
}
|
||||||
up(&audit_netlink_sem);
|
mutex_unlock(&audit_netlink_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/audit.h>
|
#include <linux/audit.h>
|
||||||
|
|
||||||
|
@ -84,4 +85,4 @@ extern void audit_send_reply(int pid, int seq, int type,
|
||||||
void *payload, int size);
|
void *payload, int size);
|
||||||
extern void audit_log_lost(const char *message);
|
extern void audit_log_lost(const char *message);
|
||||||
extern void audit_panic(const char *message);
|
extern void audit_panic(const char *message);
|
||||||
extern struct semaphore audit_netlink_sem;
|
extern struct mutex audit_netlink_mutex;
|
||||||
|
|
|
@ -329,7 +329,7 @@ static int audit_compare_rule(struct audit_krule *a, struct audit_krule *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add rule to given filterlist if not a duplicate. Protected by
|
/* Add rule to given filterlist if not a duplicate. Protected by
|
||||||
* audit_netlink_sem. */
|
* audit_netlink_mutex. */
|
||||||
static inline int audit_add_rule(struct audit_entry *entry,
|
static inline int audit_add_rule(struct audit_entry *entry,
|
||||||
struct list_head *list)
|
struct list_head *list)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,7 @@ static inline int audit_add_rule(struct audit_entry *entry,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove an existing rule from filterlist. Protected by
|
/* Remove an existing rule from filterlist. Protected by
|
||||||
* audit_netlink_sem. */
|
* audit_netlink_mutex. */
|
||||||
static inline int audit_del_rule(struct audit_entry *entry,
|
static inline int audit_del_rule(struct audit_entry *entry,
|
||||||
struct list_head *list)
|
struct list_head *list)
|
||||||
{
|
{
|
||||||
|
@ -383,10 +383,10 @@ static int audit_list(void *_dest)
|
||||||
seq = dest[1];
|
seq = dest[1];
|
||||||
kfree(dest);
|
kfree(dest);
|
||||||
|
|
||||||
down(&audit_netlink_sem);
|
mutex_lock(&audit_netlink_mutex);
|
||||||
|
|
||||||
/* The *_rcu iterators not needed here because we are
|
/* The *_rcu iterators not needed here because we are
|
||||||
always called with audit_netlink_sem held. */
|
always called with audit_netlink_mutex held. */
|
||||||
for (i=0; i<AUDIT_NR_FILTERS; i++) {
|
for (i=0; i<AUDIT_NR_FILTERS; i++) {
|
||||||
list_for_each_entry(entry, &audit_filter_list[i], list) {
|
list_for_each_entry(entry, &audit_filter_list[i], list) {
|
||||||
struct audit_rule *rule;
|
struct audit_rule *rule;
|
||||||
|
@ -401,7 +401,7 @@ static int audit_list(void *_dest)
|
||||||
}
|
}
|
||||||
audit_send_reply(pid, seq, AUDIT_LIST, 1, 1, NULL, 0);
|
audit_send_reply(pid, seq, AUDIT_LIST, 1, 1, NULL, 0);
|
||||||
|
|
||||||
up(&audit_netlink_sem);
|
mutex_unlock(&audit_netlink_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,10 +417,10 @@ static int audit_list_rules(void *_dest)
|
||||||
seq = dest[1];
|
seq = dest[1];
|
||||||
kfree(dest);
|
kfree(dest);
|
||||||
|
|
||||||
down(&audit_netlink_sem);
|
mutex_lock(&audit_netlink_mutex);
|
||||||
|
|
||||||
/* The *_rcu iterators not needed here because we are
|
/* The *_rcu iterators not needed here because we are
|
||||||
always called with audit_netlink_sem held. */
|
always called with audit_netlink_mutex held. */
|
||||||
for (i=0; i<AUDIT_NR_FILTERS; i++) {
|
for (i=0; i<AUDIT_NR_FILTERS; i++) {
|
||||||
list_for_each_entry(e, &audit_filter_list[i], list) {
|
list_for_each_entry(e, &audit_filter_list[i], list) {
|
||||||
struct audit_rule_data *data;
|
struct audit_rule_data *data;
|
||||||
|
@ -435,7 +435,7 @@ static int audit_list_rules(void *_dest)
|
||||||
}
|
}
|
||||||
audit_send_reply(pid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0);
|
audit_send_reply(pid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0);
|
||||||
|
|
||||||
up(&audit_netlink_sem);
|
mutex_unlock(&audit_netlink_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue