aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2013-04-30 11:28:04 -0400
committerEric Paris <eparis@redhat.com>2013-04-30 15:31:28 -0400
commit7173c54e3a9deb491a586e7e107375109ee48bcb (patch)
treeeb421f7b9c16125217cb2797e0c24e535cd1f1bc /kernel/audit.c
parentbee0a224e791cccbc7ecd7faf2d5932942668976 (diff)
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)
805 case AUDIT_TTY_GET: { 805 case AUDIT_TTY_GET: {
806 struct audit_tty_status s; 806 struct audit_tty_status s;
807 struct task_struct *tsk = current; 807 struct task_struct *tsk = current;
808 unsigned long flags;
809 808
810 spin_lock_irqsave(&tsk->sighand->siglock, flags); 809 spin_lock(&tsk->sighand->siglock);
811 s.enabled = tsk->signal->audit_tty != 0; 810 s.enabled = tsk->signal->audit_tty != 0;
812 s.log_passwd = tsk->signal->audit_tty_log_passwd; 811 s.log_passwd = tsk->signal->audit_tty_log_passwd;
813 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 812 spin_unlock(&tsk->sighand->siglock);
814 813
815 audit_send_reply(NETLINK_CB(skb).portid, seq, 814 audit_send_reply(NETLINK_CB(skb).portid, seq,
816 AUDIT_TTY_GET, 0, 0, &s, sizeof(s)); 815 AUDIT_TTY_GET, 0, 0, &s, sizeof(s));
@@ -819,7 +818,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
819 case AUDIT_TTY_SET: { 818 case AUDIT_TTY_SET: {
820 struct audit_tty_status s; 819 struct audit_tty_status s;
821 struct task_struct *tsk = current; 820 struct task_struct *tsk = current;
822 unsigned long flags;
823 821
824 memset(&s, 0, sizeof(s)); 822 memset(&s, 0, sizeof(s));
825 /* guard against past and future API changes */ 823 /* guard against past and future API changes */
@@ -828,10 +826,10 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
828 (s.log_passwd != 0 && s.log_passwd != 1)) 826 (s.log_passwd != 0 && s.log_passwd != 1))
829 return -EINVAL; 827 return -EINVAL;
830 828
831 spin_lock_irqsave(&tsk->sighand->siglock, flags); 829 spin_lock(&tsk->sighand->siglock);
832 tsk->signal->audit_tty = s.enabled; 830 tsk->signal->audit_tty = s.enabled;
833 tsk->signal->audit_tty_log_passwd = s.log_passwd; 831 tsk->signal->audit_tty_log_passwd = s.log_passwd;
834 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 832 spin_unlock(&tsk->sighand->siglock);
835 break; 833 break;
836 } 834 }
837 default: 835 default: