History log of /drivers/tty/tty_audit.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
00bff392c81e4fb1901e5160fdd5afdb2546a6ab 03-Mar-2011 Xiaotian Feng <dfeng@redhat.com> tty_audit: fix tty_audit_add_data live lock on audit disabled

The current tty_audit_add_data code:

do {
size_t run;

run = N_TTY_BUF_SIZE - buf->valid;
if (run > size)
run = size;
memcpy(buf->data + buf->valid, data, run);
buf->valid += run;
data += run;
size -= run;
if (buf->valid == N_TTY_BUF_SIZE)
tty_audit_buf_push_current(buf);
} while (size != 0);

If the current buffer is full, kernel will then call tty_audit_buf_push_current
to empty the buffer. But if we disabled audit at the same time, tty_audit_buf_push()
returns immediately if audit_enabled is zero. Without emptying the buffer.
With obvious effect on tty_audit_add_data() that ends up spinning in that loop,
copying 0 bytes at each iteration and attempting to push each time without any effect.
Holding the lock all along.

Suggested-by: Alexander Viro <aviro@redhat.com>
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/tty/tty_audit.c
96fd7ce58ffb5c7bf376796b5525ba3ea1c9d69f 04-Nov-2010 Greg Kroah-Hartman <gregkh@suse.de> TTY: create drivers/tty and move the tty core files there

The tty code should be in its own subdirectory and not in the char
driver with all of the cruft that is currently there.

Based on work done by Arnd Bergmann <arnd@arndb.de>

Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/tty/tty_audit.c