public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Li Zefan <lizf@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	a.p.zijlstra@chello.nl, lizf@cn.fujitsu.com, tglx@linutronix.de,
	avi@redhat.com, mingo@elte.hu
Subject: [tip:perf/core] perf, trace: Fix module leak
Date: Thu, 9 Sep 2010 19:45:07 GMT	[thread overview]
Message-ID: <tip-9cb627d5f38830ca19aa0dca52d1d3a633018bf7@git.kernel.org> (raw)
In-Reply-To: <4C7E1F12.8030304@cn.fujitsu.com>

Commit-ID:  9cb627d5f38830ca19aa0dca52d1d3a633018bf7
Gitweb:     http://git.kernel.org/tip/9cb627d5f38830ca19aa0dca52d1d3a633018bf7
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Wed, 1 Sep 2010 12:58:43 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:38:51 +0200

perf, trace: Fix module leak

Commit 1c024eca (perf, trace: Optimize tracepoints by using
per-tracepoint-per-cpu hlist to track events) caused a module
refcount leak.

Reported-And-Tested-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4C7E1F12.8030304@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/trace/trace_event_perf.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 000e6e8..31cc4cb 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -91,6 +91,8 @@ int perf_trace_init(struct perf_event *p_event)
 		    tp_event->class && tp_event->class->reg &&
 		    try_module_get(tp_event->mod)) {
 			ret = perf_trace_event_init(tp_event, p_event);
+			if (ret)
+				module_put(tp_event->mod);
 			break;
 		}
 	}
@@ -146,6 +148,7 @@ void perf_trace_destroy(struct perf_event *p_event)
 		}
 	}
 out:
+	module_put(tp_event->mod);
 	mutex_unlock(&event_mutex);
 }
 

      parent reply	other threads:[~2010-09-09 19:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01  8:42 ftrace/perf_event leak Avi Kivity
2010-09-01  9:04 ` Peter Zijlstra
2010-09-01  9:26   ` Avi Kivity
2010-09-01  9:35     ` Peter Zijlstra
2010-09-01  9:38     ` Li Zefan
2010-09-01  9:41       ` Peter Zijlstra
2010-09-01 10:38       ` Avi Kivity
2010-09-01 11:02         ` Peter Zijlstra
2010-09-01 11:07           ` Ingo Molnar
2010-09-01 12:15           ` Frederic Weisbecker
2010-09-01 13:59             ` Steven Rostedt
2010-09-01 17:32               ` Ingo Molnar
2010-09-02  1:20             ` Li Zefan
2010-09-09 19:45       ` tip-bot for Li Zefan [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-9cb627d5f38830ca19aa0dca52d1d3a633018bf7@git.kernel.org \
    --to=lizf@cn.fujitsu.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=avi@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=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