summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Bohe <frederic.bohe@bull.net>2008-06-20 11:48:48 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-06-20 11:48:48 -0400
commit2856922c158605514ec5974a03097eaec91f4c0d (patch)
tree1b3cdadf7f4f4302d8d16eb8d310ab7811846de3
parent5dd34572ad9a3be430632dd42e4af2ea370b397b (diff)
downloadkernel-crypto-2856922c158605514ec5974a03097eaec91f4c0d.tar.gz
kernel-crypto-2856922c158605514ec5974a03097eaec91f4c0d.tar.xz
kernel-crypto-2856922c158605514ec5974a03097eaec91f4c0d.zip
Ext4: Fix online resize block group descriptor corruption
This is the patch for the group descriptor table corruption during online resize pointed out by Theodore Tso. The problem was caused by the fact that the ext4 group descriptor can be either 32 or 64 bytes long. Only the 64 bytes structure was taken into account. Signed-off-by: Frederic Bohe <frederic.bohe@bull.net> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/resize.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 9ecb92f6854..9ff7b1c0423 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -855,7 +855,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
*/
/* Update group descriptor block for new group */
- gdp = (struct ext4_group_desc *)primary->b_data + gdb_off;
+ gdp = (struct ext4_group_desc *)((char *)primary->b_data +
+ gdb_off * EXT4_DESC_SIZE(sb));
ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */
ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */