[PATCH 20/42] ext4: add missing unlock in ext4_check_descriptors() on error path

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Theodore Ts'o
Date: Wednesday, October 8, 2008 - 9:05 pm

From: Li Zefan <lizf@cn.fujitsu.com>

If there group descriptors are corrupted we need unlock the block
group lock before returning from the function; else we will oops when
freeing a spinlock which is still being held.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/ext4/super.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 64e1c21..8175318 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1623,8 +1623,10 @@ static int ext4_check_descriptors(struct super_block *sb)
 			       "Checksum for group %lu failed (%u!=%u)\n",
 			       i, le16_to_cpu(ext4_group_desc_csum(sbi, i,
 			       gdp)), le16_to_cpu(gdp->bg_checksum));
-			if (!(sb->s_flags & MS_RDONLY))
+			if (!(sb->s_flags & MS_RDONLY)) {
+				spin_unlock(sb_bgl_lock(sbi, i));
 				return 0;
+			}
 		}
 		spin_unlock(sb_bgl_lock(sbi, i));
 		if (!flexbg_flag)
-- 
1.5.6.1.205.ge2c7.dirty

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 03/42] ext4: Fix long long checkpatch warnings, Theodore Ts'o, (Wed Oct 8, 9:05 pm)
[PATCH 07/42] ext4: Retry block reservation, Theodore Ts'o, (Wed Oct 8, 9:05 pm)
[PATCH 08/42] ext4: Add percpu dirty block accounting., Theodore Ts'o, (Wed Oct 8, 9:05 pm)
[PATCH 10/42] ext4: Signed arithmetic fix, Theodore Ts'o, (Wed Oct 8, 9:05 pm)
[PATCH 15/42] ext4: Properly update i_disksize., Theodore Ts'o, (Wed Oct 8, 9:05 pm)
[PATCH 20/42] ext4: add missing unlock in ext4_check_descr ..., Theodore Ts'o, (Wed Oct 8, 9:05 pm)
[PATCH 23/42] ext4: Renumber EXT4_IOC_MIGRATE, Theodore Ts'o, (Wed Oct 8, 9:05 pm)