ext4: fix possible use after free with metadata csum
authorTheodore Ts'o <tytso@mit.edu>
Fri, 30 Nov 2012 02:21:22 +0000 (21:21 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 16:50:45 +0000 (08:50 -0800)
commit6b4b4679f40d6d112eda435a9dde937bb41c9bfc
tree8bcd606d90b4db025a12d1cd5f50e2473f77419c
parentaadee0f004ac85d2afd1cd03279d3dc01363258c
ext4: fix possible use after free with metadata csum

commit aeb1e5d69a5be592e86a926be73efb38c55af404 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ialloc.c