tty: audit: Early-out pty master reads earlier
authorPeter Hurley <peter@hurleysoftware.com>
Sun, 10 Jan 2016 06:55:25 +0000 (22:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jan 2016 00:41:04 +0000 (16:41 -0800)
Reads from pty masters are not logged; early-out before taking
locks.

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

index 3d245cd3d8e62082301b7061144ec2329cf16609..ead924e4bd539ef043546d997a7b46a922bd0cdc 100644 (file)
@@ -276,16 +276,16 @@ void tty_audit_add_data(struct tty_struct *tty, const void *data,
        if (unlikely(size == 0))
                return;
 
+       if (tty->driver->type == TTY_DRIVER_TYPE_PTY
+           && tty->driver->subtype == PTY_TYPE_MASTER)
+               return;
+
        spin_lock_irqsave(&current->sighand->siglock, flags);
        audit_log_tty_passwd = current->signal->audit_tty_log_passwd;
        spin_unlock_irqrestore(&current->sighand->siglock, flags);
        if (!audit_log_tty_passwd && icanon && !L_ECHO(tty))
                return;
 
-       if (tty->driver->type == TTY_DRIVER_TYPE_PTY
-           && tty->driver->subtype == PTY_TYPE_MASTER)
-               return;
-
        buf = tty_audit_buf_get(tty, icanon);
        if (!buf)
                return;