Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: juha_niskanen@mentor.com (Niskanen, Juha)
Subject: [ltt-dev] [PATCH] lttng-modules v0.19-stable: setup_trace_write: Fix recursive locking
Date: Thu, 24 Nov 2011 18:20:43 +0000	[thread overview]
Message-ID: <052CC93207FFD7418F2DA02D434F334C13B90EA6@EU-MBX-01.mgc.mentorg.com> (raw)

lttng-modules: ltt_trace_destroy calls ltt_lock_traces internally so this non-recursive
mutex must be first unlocked when executing error handling code.

Signed-off-by: Juha Niskanen <juha_niskanen at mentor.com>
---
 ltt-trace-control.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ltt-trace-control.c b/ltt-trace-control.c
index 9d6d239..12a3f19 100644
--- a/ltt-trace-control.c
+++ b/ltt-trace-control.c
@@ -734,6 +734,8 @@ ssize_t setup_trace_write(struct file *file, const char __user *user_buf,
 	if (IS_ERR_VALUE(err)) {
 		printk(KERN_ERR "setup_trace_write: "
 		       "_create_trace_control_dir failed: %d\n", err);
+		ltt_unlock_traces();
+		ltt_trace_destroy(trace_name);
 		goto err_create_trace_control_dir;
 	}
 
@@ -744,10 +746,9 @@ ssize_t setup_trace_write(struct file *file, const char __user *user_buf,
 	free_page((unsigned long)trace_name);
 	return count;
 
-err_create_trace_control_dir:
-	ltt_trace_destroy(trace_name);
 err_setup_trace:
 	ltt_unlock_traces();
+err_create_trace_control_dir:
 	mutex_unlock(&control_lock);
 err_get_tracename:
 err_copy_from_user:
-- 
1.7.3.4





             reply	other threads:[~2011-11-24 18:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24 18:20 Niskanen, Juha [this message]
2011-11-25 22:00 ` Mathieu Desnoyers

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=052CC93207FFD7418F2DA02D434F334C13B90EA6@EU-MBX-01.mgc.mentorg.com \
    --to=juha_niskanen@mentor.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