ext4: bail out from make_indexed_dir() on first error
authorJan Kara <jack@suse.cz>
Thu, 30 Oct 2014 14:53:17 +0000 (10:53 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 14 Dec 2014 16:23:53 +0000 (16:23 +0000)
commit9769c00cdd3cb924c02f9e6eea0eb2212fc07e36
tree76c80098315c63a7ddef87836aec35b0b7f35be0
parent93604e7651f6cfccaa34d4fdb18b6a337594912e
ext4: bail out from make_indexed_dir() on first error

commit 6050d47adcadbb53582434d919ed7f038d936712 upstream.

When ext4_handle_dirty_dx_node() or ext4_handle_dirty_dirent_node()
fail, there's really something wrong with the fs and there's no point in
continuing further. Just return error from make_indexed_dir() in that
case. Also initialize frames array so that if we return early due to
error, dx_release() doesn't try to dereference uninitialized memory
(which could happen also due to error in do_split()).

Coverity-id: 741300
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.2:
 - We have ext4_handle_dirty_metadata() not
   ext4_handle_dirty_{dx,dirent}_node()]
 - do_split() returns errors by reference not with ERR_PTR()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/namei.c