public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: mingo@elte.hu
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Jiri Slaby <jirislaby@gmail.com>,
	Tom Zanussi <tzanussi@gmail.com>
Subject: [PATCH 3/3] trace: events_filter, fix lock imbalances
Date: Thu, 28 May 2009 09:54:49 +0200	[thread overview]
Message-ID: <1243497289-18591-3-git-send-email-jirislaby@gmail.com> (raw)
In-Reply-To: <1243497289-18591-1-git-send-email-jirislaby@gmail.com>

apply_event_filter and apply_subsystem_event_filter omits an unlock
on one fail path each. Fix that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
---
 kernel/trace/trace_events_filter.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 85ad6a8..e35094a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1080,8 +1080,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
 	}
 
 	ps = kzalloc(sizeof(*ps), GFP_KERNEL);
-	if (!ps)
-		return -ENOMEM;
+	if (!ps) {
+		err = -ENOMEM;
+		goto unlock;
+	}
 
 	filter_disable_preds(call);
 	replace_filter_string(call->filter, filter_string);
@@ -1101,7 +1103,7 @@ out:
 	filter_opstack_clear(ps);
 	postfix_clear(ps);
 	kfree(ps);
-
+unlock:
 	mutex_unlock(&filter_mutex);
 
 	return err;
@@ -1124,8 +1126,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
 	}
 
 	ps = kzalloc(sizeof(*ps), GFP_KERNEL);
-	if (!ps)
-		return -ENOMEM;
+	if (!ps) {
+		err = -ENOMEM;
+		goto unlock;
+	}
 
 	filter_free_subsystem_preds(system);
 	replace_filter_string(system->filter, filter_string);
@@ -1145,7 +1149,7 @@ out:
 	filter_opstack_clear(ps);
 	postfix_clear(ps);
 	kfree(ps);
-
+unlock:
 	mutex_unlock(&filter_mutex);
 
 	return err;
-- 
1.6.3


  parent reply	other threads:[~2009-05-28  8:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28  7:54 [PATCH 1/3] x86: apic, restore irqs on fail paths Jiri Slaby
2009-05-28  7:54 ` [PATCH 2/3] x86: amd_iommu, fix lock imbalance Jiri Slaby
2009-06-03  8:36   ` Joerg Roedel
2009-05-28  7:54 ` Jiri Slaby [this message]
2009-05-29  1:14   ` [PATCH 3/3] trace: events_filter, fix lock imbalances Li Zefan
2009-05-29 15:57     ` Jiri Slaby
2009-05-29 17:21 ` [PATCH 1/3] x86: apic, restore irqs on fail paths Cyrill Gorcunov
2009-06-02  0:51 ` [tip:irq/numa] x86, apic: Restore " tip-bot for Jiri Slaby

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=1243497289-18591-3-git-send-email-jirislaby@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tzanussi@gmail.com \
    --cc=x86@kernel.org \
    /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