Skip to content

Commit d415a7f

Browse files
clyuIngo Molnar
authored andcommitted
perf: Fix context leak in put_event()
Commit: a83fe28 ("perf: Fix put_event() ctx lock") changed the locking logic in put_event() by replacing mutex_lock_nested() with perf_event_ctx_lock_nested(), but didn't fix the subsequent mutex_unlock() with a correct counterpart, perf_event_ctx_unlock(). Contexts are thus leaked as a result of incremented refcount in perf_event_ctx_lock_nested(). Signed-off-by: Leon Yu <chianglungyu@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Fixes: a83fe28 ("perf: Fix put_event() ctx lock") Link: http://lkml.kernel.org/r/1424954613-5034-1-git-send-email-chianglungyu@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent e678fef commit d415a7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3591,7 +3591,7 @@ static void put_event(struct perf_event *event)
35913591
ctx = perf_event_ctx_lock_nested(event, SINGLE_DEPTH_NESTING);
35923592
WARN_ON_ONCE(ctx->parent_ctx);
35933593
perf_remove_from_context(event, true);
3594-
mutex_unlock(&ctx->mutex);
3594+
perf_event_ctx_unlock(event, ctx);
35953595

35963596
_free_event(event);
35973597
}

0 commit comments

Comments
 (0)