diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-11-13 08:58:31 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-13 08:58:31 -0500 |
commit | ee51a1de7e3837577412be269e0100038068e691 (patch) | |
tree | a93d6dfeec829b61d6a74b5a9c841bcfeaeeb31d /kernel/trace/ring_buffer.c | |
parent | 47e74f2ba8fbf9fb1378e2524e6cfdc2fb37f160 (diff) |
tracing: fix mmiotrace resizing crash
Pekka reported a crash when resizing the mmiotrace tracer (if only
mmiotrace is enabled).
This happens because in that case we do not allocate the max buffer,
but we try to use it.
Make ring_buffer_resize() idempotent against NULL buffers.
Reported-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r-- | kernel/trace/ring_buffer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 231db209fa82..036456cbb4f7 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -538,6 +538,12 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size) | |||
538 | LIST_HEAD(pages); | 538 | LIST_HEAD(pages); |
539 | int i, cpu; | 539 | int i, cpu; |
540 | 540 | ||
541 | /* | ||
542 | * Always succeed at resizing a non-existent buffer: | ||
543 | */ | ||
544 | if (!buffer) | ||
545 | return size; | ||
546 | |||
541 | size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); | 547 | size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); |
542 | size *= BUF_PAGE_SIZE; | 548 | size *= BUF_PAGE_SIZE; |
543 | buffer_size = buffer->pages * BUF_PAGE_SIZE; | 549 | buffer_size = buffer->pages * BUF_PAGE_SIZE; |