diff options
| author | Jing Xia <[email protected]> | 2017-12-26 15:12:53 +0800 | 
|---|---|---|
| committer | Steven Rostedt (VMware) <[email protected]> | 2017-12-27 14:21:16 -0500 | 
| commit | 24f2aaf952ee0b59f31c3a18b8b36c9e3d3c2cf5 (patch) | |
| tree | 71b67158bafbf065414d539c2fabffeaae591f44 /net/sunrpc/svcauth_unix.c | |
| parent | ae415fa4c5248a8cf4faabd5a3c20576cb1ad607 (diff) | |
tracing: Fix crash when it fails to alloc ring buffer
Double free of the ring buffer happens when it fails to alloc new
ring buffer instance for max_buffer if TRACER_MAX_TRACE is configured.
The root cause is that the pointer is not set to NULL after the buffer
is freed in allocate_trace_buffers(), and the freeing of the ring
buffer is invoked again later if the pointer is not equal to Null,
as:
instance_mkdir()
    |-allocate_trace_buffers()
        |-allocate_trace_buffer(tr, &tr->trace_buffer...)
	|-allocate_trace_buffer(tr, &tr->max_buffer...)
          // allocate fail(-ENOMEM),first free
          // and the buffer pointer is not set to null
        |-ring_buffer_free(tr->trace_buffer.buffer)
       // out_free_tr
    |-free_trace_buffers()
        |-free_trace_buffer(&tr->trace_buffer);
	      //if trace_buffer is not null, free again
	    |-ring_buffer_free(buf->buffer)
                |-rb_free_cpu_buffer(buffer->buffers[cpu])
                    // ring_buffer_per_cpu is null, and
                    // crash in ring_buffer_per_cpu->pages
Link: http://lkml.kernel.org/r/[email protected]
Cc: [email protected]
Fixes: 737223fbca3b1 ("tracing: Consolidate buffer allocation code")
Signed-off-by: Jing Xia <[email protected]>
Signed-off-by: Chunyan Zhang <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
0 files changed, 0 insertions, 0 deletions