summaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_audit.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-10 07:55:29 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-28 01:41:04 +0100
commitf229c2c161de94a404fa16a17cb93c4a06938af5 (patch)
treed99d57f3008d56c391bd85691850d2087d270ec8 /drivers/tty/tty_audit.c
parenttty: audit: Defer audit buffer association (diff)
downloadlinux-f229c2c161de94a404fa16a17cb93c4a06938af5.tar.xz
linux-f229c2c161de94a404fa16a17cb93c4a06938af5.zip
tty: audit: Take siglock directly
lock_task_sighand() is for situations where the struct task_struct* may disappear while trying to deref the sighand; this never applies to 'current'. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_audit.c')
-rw-r--r--drivers/tty/tty_audit.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 9effa81acdfc..5f65653cee48 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -180,22 +180,19 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch)
int tty_audit_push_current(void)
{
struct tty_audit_buf *buf = ERR_PTR(-EPERM);
- struct task_struct *tsk = current;
unsigned long flags;
- if (!lock_task_sighand(tsk, &flags))
- return -ESRCH;
-
- if (tsk->signal->audit_tty) {
- buf = tsk->signal->tty_audit_buf;
+ spin_lock_irqsave(&current->sighand->siglock, flags);
+ if (current->signal->audit_tty) {
+ buf = current->signal->tty_audit_buf;
if (buf)
atomic_inc(&buf->count);
}
- unlock_task_sighand(tsk, &flags);
+ spin_unlock_irqrestore(&current->sighand->siglock, flags);
/*
* Return 0 when signal->audit_tty set
- * but tsk->signal->tty_audit_buf == NULL.
+ * but current->signal->tty_audit_buf == NULL.
*/
if (!buf || IS_ERR(buf))
return PTR_ERR(buf);