mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>,
	Will Deacon <will.deacon@arm.com>,
	David Miller <davem@davemloft.net>,
	Paul Mundt <lethal@linux-sh.org>, Borislav Petkov <bp@amd64.org>
Subject: [RFC PATCH 6/6] perf: Fix double put_ctx
Date: Thu,  1 Jul 2010 17:36:02 +0200	[thread overview]
Message-ID: <1277998562-21366-7-git-send-regression-fweisbec@gmail.com> (raw)
In-Reply-To: <1277998562-21366-1-git-send-regression-fweisbec@gmail.com>

If we call free_event on fail case of event creation, it
already put the context. The falldown goto, though, also
does a put_ctx, which might dereference a freed context.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: David Miller <davem@davemloft.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Borislav Petkov <bp@amd64.org>
---
 kernel/perf_event.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index b6e854f..925b53e 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5364,6 +5364,8 @@ SYSCALL_DEFINE5(perf_event_open,
 
 err_free_put_context:
 	free_event(event);
+	fput_light(group_file, fput_needed);
+	goto err_fd;
 err_put_context:
 	fput_light(group_file, fput_needed);
 	put_ctx(ctx);
-- 
1.6.2.3


      parent reply	other threads:[~2010-07-01 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 15:35 [RFC PATCH 0/6] perf: cleanup and fixes Frederic Weisbecker
2010-07-01 15:35 ` [RFC PATCH 1/6] perf: Drop unappropriate tests on arch callchains Frederic Weisbecker
2010-07-01 15:35 ` [RFC PATCH 2/6] perf: Generalize callchain_store() Frederic Weisbecker
2010-07-01 15:35 ` [RFC PATCH 3/6] perf: Generalize some arch callchain code Frederic Weisbecker
2010-07-01 15:46   ` Peter Zijlstra
2010-07-01 15:47     ` Frederic Weisbecker
2010-07-01 15:49     ` Frederic Weisbecker
2010-07-01 15:51       ` Peter Zijlstra
2010-07-01 15:53         ` Frederic Weisbecker
2010-07-01 15:36 ` [RFC PATCH 4/6] perf: Factorize callchain context handling Frederic Weisbecker
2010-07-01 15:36 ` [RFC PATCH 5/6] perf: Fix race in callchains Frederic Weisbecker
2010-07-01 15:42   ` Frederic Weisbecker
2010-07-02 18:07   ` Peter Zijlstra
2010-07-03 20:28     ` Frederic Weisbecker
2010-07-01 15:36 ` Frederic Weisbecker [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=1277998562-21366-7-git-send-regression-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=bp@amd64.org \
    --cc=davem@davemloft.net \
    --cc=eranian@google.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=will.deacon@arm.com \
    /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

all inboxes | Powered by JetHome®