public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Tejun Heo <tj@kernel.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, hpa@zytor.com,
	mingo@redhat.com, peterz@infradead.org, paulus@au1.ibm.com,
	stable@kernel.org, tj@kernel.org, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:perf/urgent] perf: Fix resource leak in failure path of perf_event_open()
Date: Sat, 1 May 2010 11:54:41 GMT	[thread overview]
Message-ID: <tip-048c852051d2bd5da54a4488bc1f16b0fc74c695@git.kernel.org> (raw)
In-Reply-To: <4BDBE237.1040809@kernel.org>

Commit-ID:  048c852051d2bd5da54a4488bc1f16b0fc74c695
Gitweb:     http://git.kernel.org/tip/048c852051d2bd5da54a4488bc1f16b0fc74c695
Author:     Tejun Heo <tj@kernel.org>
AuthorDate: Sat, 1 May 2010 10:11:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 1 May 2010 13:11:25 +0200

perf: Fix resource leak in failure path of perf_event_open()

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>
---
 kernel/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 2f3fbf8..3d1552d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4897,7 +4897,7 @@ err_fput_free_put_context:
 
 err_free_put_context:
 	if (err < 0)
-		kfree(event);
+		free_event(event);
 
 err_put_context:
 	if (err < 0)

      reply	other threads:[~2010-05-01 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-01  8:11 [PATCH tip/perf] perf: fix resource leak in failure path of perf_event_open() Tejun Heo
2010-05-01 11:54 ` tip-bot for Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-048c852051d2bd5da54a4488bc1f16b0fc74c695@git.kernel.org \
    --to=tj@kernel.org \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@au1.ibm.com \
    --cc=peterz@infradead.org \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox