summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-13 14:58:31 +0100
committerIngo Molnar <mingo@elte.hu>2008-11-13 14:58:31 +0100
commitee51a1de7e3837577412be269e0100038068e691 (patch)
treea93d6dfeec829b61d6a74b5a9c841bcfeaeeb31d
parent47e74f2ba8fbf9fb1378e2524e6cfdc2fb37f160 (diff)
downloadkernel-crypto-ee51a1de7e3837577412be269e0100038068e691.tar.gz
kernel-crypto-ee51a1de7e3837577412be269e0100038068e691.tar.xz
kernel-crypto-ee51a1de7e3837577412be269e0100038068e691.zip
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>
-rw-r--r--kernel/trace/ring_buffer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 231db209fa8..036456cbb4f 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)
LIST_HEAD(pages);
int i, cpu;
+ /*
+ * Always succeed at resizing a non-existent buffer:
+ */
+ if (!buffer)
+ return size;
+
size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
size *= BUF_PAGE_SIZE;
buffer_size = buffer->pages * BUF_PAGE_SIZE;