aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ialloc.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2012-11-29 21:21:22 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-11-29 21:21:22 -0500
commitaeb1e5d69a5be592e86a926be73efb38c55af404 (patch)
treeaddd38abf4d74fc6fd54829cff1c3fb9fb832c31 /fs/ext4/ialloc.c
parent69c499d152a7fe2c4443e5ddd91568ad5a79145a (diff)
ext4: fix possible use after free with metadata csum
Commit fa77dcfafeaa introduces block bitmap checksum calculation into ext4_new_inode() in the case that block group was uninitialized. However we brelse() the bitmap buffer before we attempt to checksum it so we have no guarantee that the buffer is still there. Fix this by releasing the buffer after the possible checksum computation. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Acked-by: Darrick J. Wong <darrick.wong@oracle.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r--fs/ext4/ialloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 3a100e7a62a8..c7efa88d7149 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -762,7 +762,6 @@ got:
762 762
763 BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); 763 BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap");
764 err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh); 764 err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh);
765 brelse(block_bitmap_bh);
766 765
767 /* recheck and clear flag under lock if we still need to */ 766 /* recheck and clear flag under lock if we still need to */
768 ext4_lock_group(sb, group); 767 ext4_lock_group(sb, group);
@@ -775,6 +774,7 @@ got:
775 ext4_group_desc_csum_set(sb, group, gdp); 774 ext4_group_desc_csum_set(sb, group, gdp);
776 } 775 }
777 ext4_unlock_group(sb, group); 776 ext4_unlock_group(sb, group);
777 brelse(block_bitmap_bh);
778 778
779 if (err) 779 if (err)
780 goto fail; 780 goto fail;