lkml.org 
[lkml]   [2009]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] tracing: Check total refcount before releasing bufs in profile_enable failure
    Frederic Weisbecker writes:

    > When we call the profile_enable() callback of an event, we release the
    > shared perf event tracing buffers unconditionnaly in the failure path.
    > This is wrong because there may be other users of these. Then check the
    > total refcount before doing this.

    [snip]

    > - kfree(trace_profile_buf_nmi);
    > fail_buf_nmi:
    > - kfree(trace_profile_buf);
    > + if (!total_profile_count) {

    A small problem here: total_profile_count will be 1, not 0, in the
    case where we need to free...

    > + kfree(trace_profile_buf_nmi);
    > + kfree(trace_profile_buf);
    > + trace_profile_buf_nmi = NULL;
    > + trace_profile_buf = NULL;
    > + }
    > fail_buf:
    > - total_profile_count--;

    since we don't decrement total_profile_count until here.

    Paul.


    \
     
     \ /
      Last update: 2009-10-07 05:17    [W:0.033 / U:0.652 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site