lkml.org 
[lkml]   [2009]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] audit: Call tty_audit_push_task() outside preempt disabled region
    On 12/01, Thomas Gleixner wrote:
    >
    > -void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid)
    > +int tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid)
    > {
    > - struct tty_audit_buf *buf;
    > + struct tty_audit_buf *buf = NULL;
    > + unsigned long flags;
    >
    > - spin_lock_irq(&tsk->sighand->siglock);
    > - buf = tsk->signal->tty_audit_buf;
    > - if (buf)
    > + if (!lock_task_sighand(tsk, &flags))
    > + return -ESRCH;
    > +
    > + if (tsk->signal->audit_tty && tsk->signal->tty_audit_buf) {
    > + buf = tsk->signal->tty_audit_buf;
    > atomic_inc(&buf->count);
    > - spin_unlock_irq(&tsk->sighand->siglock);
    > + }
    > + unlock_task_sighand(tsk, &flags);
    > +
    > if (!buf)
    > - return;
    > + return -EPERM;

    I think the patch is correct, but it changes the behaviour of
    audit_prepare_user_tty() a bit.

    Suppose that signal->audit_tty != NULL but signal->tty_audit_buf
    is not allocated yet. In this audit_prepare_user_tty() returns 0
    before the patch and -EPERM after.

    I do not know if this matters, just to be sure this is OK.

    Oleg.



    \
     
     \ /
      Last update: 2009-12-01 19:31    [W:5.200 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site