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>
This commit is contained in:
parent
a75c9b0912
commit
f229c2c161
@ -180,22 +180,19 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch)
|
|||||||
int tty_audit_push_current(void)
|
int tty_audit_push_current(void)
|
||||||
{
|
{
|
||||||
struct tty_audit_buf *buf = ERR_PTR(-EPERM);
|
struct tty_audit_buf *buf = ERR_PTR(-EPERM);
|
||||||
struct task_struct *tsk = current;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (!lock_task_sighand(tsk, &flags))
|
spin_lock_irqsave(¤t->sighand->siglock, flags);
|
||||||
return -ESRCH;
|
if (current->signal->audit_tty) {
|
||||||
|
buf = current->signal->tty_audit_buf;
|
||||||
if (tsk->signal->audit_tty) {
|
|
||||||
buf = tsk->signal->tty_audit_buf;
|
|
||||||
if (buf)
|
if (buf)
|
||||||
atomic_inc(&buf->count);
|
atomic_inc(&buf->count);
|
||||||
}
|
}
|
||||||
unlock_task_sighand(tsk, &flags);
|
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return 0 when signal->audit_tty set
|
* 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))
|
if (!buf || IS_ERR(buf))
|
||||||
return PTR_ERR(buf);
|
return PTR_ERR(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user