All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Kaiser <nikai@nikai.net>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ext4: fix unbalanced mutex unlock
Date: Tue, 26 Oct 2010 01:15:34 +0200	[thread overview]
Message-ID: <20101026011534.0bb7cb64@absol.kitzblitz> (raw)

Although the mutex isn't locked yet, if ext4_li_request_new
fails, the mutex would get unlocked on the error path.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 fs/ext4/super.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d0c3328..8bca022 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2915,10 +2915,8 @@ static int ext4_register_li_request(struct super_block *sb,
 	}
 
 	elr = ext4_li_request_new(sb, first_not_zeroed);
-	if (!elr) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!elr)
+		return -ENOMEM;
 
 	mutex_lock(&ext4_li_mtx);
 
-- 
1.7.2.2

             reply	other threads:[~2010-10-25 23:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25 23:15 Nicolas Kaiser [this message]
2010-10-27 20:50 ` [PATCH] ext4: fix unbalanced mutex unlock Ted Ts'o
2010-10-28 10:04   ` Nicolas Kaiser

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=20101026011534.0bb7cb64@absol.kitzblitz \
    --to=nikai@nikai.net \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.