Skip to contentSkip to conversation

ext4: fix unbalanced mutex unlock

PATCH In review Nicolas Kaiser 2 participants 3 messages Oct 25, 2010 – Oct 28, 2010 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: fix unbalanced mutex unlock

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

---
 fs/ext4/super.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
fs/ext4/super.c +2 -4
index d0c3328..8bca022 100644
@@ -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);
 
Signature · 1 line
1.7.2.2
maintainer
#1 lore raw
Quoted 4 lines · Nicolas Kaiser

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

Nice catch, thanks!! I've applied a fix to the ext4 patch queue.

- Ted

#2 lore raw

* "Ted Ts'o" <[email protected]>:

Quoted 5 lines · Nicolas Kaiser
Quoted 2 lines

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

Nice catch, thanks!! I've applied a fix to the ext4 patch queue.

Thanks for augmenting the patch - looks good to me :)

Best regards,
Nicolas Kaiser