Skip to content

Commit

Permalink
perf: Fix resource leak in failure path of perf_event_open()
Browse files Browse the repository at this point in the history
perf_event_open() kfrees event after init failure which doesn't
release all resources allocated by perf_event_alloc().  Use
free_event() instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@au1.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: <stable@kernel.org>
LKML-Reference: <4BDBE237.1040809@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Tejun Heo authored and Ingo Molnar committed May 1, 2010
1 parent 66f41d4 commit 048c852
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -4897,7 +4897,7 @@ SYSCALL_DEFINE5(perf_event_open,

err_free_put_context:
if (err < 0)
kfree(event);
free_event(event);

err_put_context:
if (err < 0)
Expand Down

0 comments on commit 048c852

Please sign in to comment.