tty: audit: Check audit enable first
authorPeter Hurley <peter@hurleysoftware.com>
Sun, 10 Jan 2016 06:55:37 +0000 (22:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jan 2016 00:41:04 +0000 (16:41 -0800)
Audit is unlikely to be enabled; check first to exit asap.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_audit.c

index 6e33e41ec74d5cbdeba3700f8aac4d087c615edb..269e41f45832ac8a42b1837b17585959f96051cf 100644 (file)
@@ -211,6 +211,10 @@ void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size)
        unsigned int audit_tty;
        dev_t dev;
 
+       audit_tty = READ_ONCE(current->signal->audit_tty);
+       if (~audit_tty & AUDIT_TTY_ENABLE)
+               return;
+
        if (unlikely(size == 0))
                return;
 
@@ -218,9 +222,6 @@ void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size)
            && tty->driver->subtype == PTY_TYPE_MASTER)
                return;
 
-       audit_tty = READ_ONCE(current->signal->audit_tty);
-       if (~audit_tty & AUDIT_TTY_ENABLE)
-               return;
        if ((~audit_tty & AUDIT_TTY_LOG_PASSWD) && icanon && !L_ECHO(tty))
                return;