summaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_audit.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-10 07:55:37 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-28 01:41:04 +0100
commitf17c3662745ea5fd4510c3dff19f9975552e1865 (patch)
tree2e8bcb99a77470e9cd2febbad2b75c9cf8f1e321 /drivers/tty/tty_audit.c
parenttty: audit: Simplify first-use allocation (diff)
downloadlinux-f17c3662745ea5fd4510c3dff19f9975552e1865.tar.xz
linux-f17c3662745ea5fd4510c3dff19f9975552e1865.zip
tty: audit: Check audit enable first
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>
Diffstat (limited to '')
-rw-r--r--drivers/tty/tty_audit.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 6e33e41ec74d..269e41f45832 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -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;