diff options
author | Xiaotian Feng <[email protected]> | 2011-03-03 18:08:24 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2011-03-07 12:04:50 -0800 |
commit | 00bff392c81e4fb1901e5160fdd5afdb2546a6ab (patch) | |
tree | d07922748b7ed4d2053ebc0e0b7dc1df1f73230f /tools/perf/util/trace-event-scripting.c | |
parent | b71dc8873427bb5bf0ce31b968c3f219a1d6d014 (diff) |
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 <[email protected]>
Signed-off-by: Xiaotian Feng <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions