summaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorEric Paris2013-04-30 17:28:04 +0200
committerEric Paris2013-04-30 21:31:28 +0200
commit7173c54e3a9deb491a586e7e107375109ee48bcb (patch)
treeeb421f7b9c16125217cb2797e0c24e535cd1f1bc /kernel/audit.c
parentaudit: do not needlessly take a lock in tty_audit_exit (diff)
downloadkernel-qcow2-linux-7173c54e3a9deb491a586e7e107375109ee48bcb.tar.gz
kernel-qcow2-linux-7173c54e3a9deb491a586e7e107375109ee48bcb.tar.xz
kernel-qcow2-linux-7173c54e3a9deb491a586e7e107375109ee48bcb.zip
audit: use spin_lock in audit_receive_msg to process tty logging
This function is called when we receive a netlink message from userspace. We don't need to worry about it coming from irq context or irqs making it re-entrant. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 998a0d4155cf..d308723d22da 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -805,12 +805,11 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
case AUDIT_TTY_GET: {
struct audit_tty_status s;
struct task_struct *tsk = current;
- unsigned long flags;
- spin_lock_irqsave(&tsk->sighand->siglock, flags);
+ spin_lock(&tsk->sighand->siglock);
s.enabled = tsk->signal->audit_tty != 0;
s.log_passwd = tsk->signal->audit_tty_log_passwd;
- spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
+ spin_unlock(&tsk->sighand->siglock);
audit_send_reply(NETLINK_CB(skb).portid, seq,
AUDIT_TTY_GET, 0, 0, &s, sizeof(s));
@@ -819,7 +818,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
case AUDIT_TTY_SET: {
struct audit_tty_status s;
struct task_struct *tsk = current;
- unsigned long flags;
memset(&s, 0, sizeof(s));
/* guard against past and future API changes */
@@ -828,10 +826,10 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
(s.log_passwd != 0 && s.log_passwd != 1))
return -EINVAL;
- spin_lock_irqsave(&tsk->sighand->siglock, flags);
+ spin_lock(&tsk->sighand->siglock);
tsk->signal->audit_tty = s.enabled;
tsk->signal->audit_tty_log_passwd = s.log_passwd;
- spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
+ spin_unlock(&tsk->sighand->siglock);
break;
}
default: