From: Kris Van Hees Date: Mon, 26 Jan 2015 21:19:54 +0000 (-0500) Subject: dtrace: do not vmalloc/vfree from probe context X-Git-Tag: v4.1.12-92~313^2~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=78ae543a2a16bc91eff67f7b096996d593fdb893;p=users%2Fjedix%2Flinux-maple.git dtrace: do not vmalloc/vfree from probe context The dtrace_stacktrace() code was using vmalloc/vfree in cases where no array for PCs was provided (as was the case for getting the stackdepth). When this code gets called from probe context, we might be processing an interrupt or trap, and it is not safe to use vmalloc/vfree in that context. We now pass in a (pre-allocated) scratch buffer instead. Orabug: 20456889 Signed-off-by: Kris Van Hees Acked-by: Nick Alcock --- diff --git a/kernel/dtrace/dtrace_os.c b/kernel/dtrace/dtrace_os.c index 3e66613e7ee4..9be9b7379137 100644 --- a/kernel/dtrace/dtrace_os.c +++ b/kernel/dtrace/dtrace_os.c @@ -391,9 +391,10 @@ void dtrace_stacktrace(stacktrace_state_t *st) trace.entries = (typeof(trace.entries))st->pcs; trace.skip = st->depth; - if (st->pcs == NULL) - trace.entries = vmalloc(trace.max_entries * - sizeof(trace.entries[0])); + if (st->pcs == NULL) { + st->depth = 0; + return; + } save_stack_trace(&trace); @@ -410,9 +411,6 @@ void dtrace_stacktrace(stacktrace_state_t *st) st->depth = trace.nr_entries; #endif - if (st->pcs == NULL) - vfree(trace.entries); - if (st->fps != NULL) { for (i = 0; i < st->limit; i++) st->fps[i] = 0;