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)
committerZefan Li <lizefan@huawei.com>
Mon, 2 Feb 2015 09:05:09 +0000 (17:05 +0800)
commitc4a4211292d9b4ab4f94b985ebf37a9d16fb8a93
tree60a70b46c75a3c6a5c3cb3a8fd7424a7b189efb8
parent9922dba85d9a2d752297ff6030f6af84156472a7
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>
[lizf: Backported to 3.4:
 - adjust context
 - replace ext4_handle_dirty_{dx,dirent}_node() with
   ext4_handle_dirty_metadata()]
Signed-off-by: Zefan Li <lizefan@huawei.com>
fs/ext4/namei.c