linux/drivers/tty
Xiaotian Feng 00bff392c8 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>
2011-03-07 12:04:50 -08:00
..
hvc Merge 2.6.38-rc6 into tty-next 2011-02-24 11:36:31 -08:00
ipwireless tty: move ipwireless driver from drivers/char/pcmcia/ to drivers/tty/ 2011-02-22 16:23:22 -08:00
serial tty/serial: Relax the device_type restriction from of_serial 2011-02-25 10:02:16 -08:00
vt tty: now phase out the ioctl file pointer for good 2011-02-17 11:59:56 -08:00
amiserial.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
bfin_jtag_comm.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
cyclades.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
isicom.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
Kconfig tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
Makefile tty: move ipwireless driver from drivers/char/pcmcia/ to drivers/tty/ 2011-02-22 16:23:22 -08:00
moxa.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
moxa.h tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
mxser.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
mxser.h tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
n_gsm.c Merge 2.6.38-rc6 into tty-next 2011-02-24 11:36:31 -08:00
n_hdlc.c
n_r3964.c
n_tty.c
nozomi.c nozomi: don't use flush_scheduled_work() 2011-02-25 11:56:10 -08:00
pty.c tty: now phase out the ioctl file pointer for good 2011-02-17 11:59:56 -08:00
rocket_int.h tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
rocket.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
rocket.h tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
synclink_gt.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
synclink.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
synclinkmp.c tty: move a number of tty drivers from drivers/char/ to drivers/tty/ 2011-02-22 16:14:56 -08:00
sysrq.c
tty_audit.c tty_audit: fix tty_audit_add_data live lock on audit disabled 2011-03-07 12:04:50 -08:00
tty_buffer.c
tty_io.c tty: add TIOCVHANGUP to allow clean tty shutdown of all ttys 2011-02-17 14:16:30 -08:00
tty_ioctl.c tty: add a helper for setting termios data from kernel side 2011-02-17 12:03:52 -08:00
tty_ldisc.c
tty_mutex.c
tty_port.c