]> git.hungrycats.org Git - linux/commitdiff
ext4: don't dereference null pointer when make_indexed_dir() fails
authorAllison Henderson <achender@linux.vnet.ibm.com>
Sun, 15 May 2011 04:19:41 +0000 (00:19 -0400)
committerWilly Tarreau <w@1wt.eu>
Mon, 10 Jun 2013 09:43:11 +0000 (11:43 +0200)
Fix for a null pointer bug found while running punch hole tests

Signed-off-by: Allison Henderson <achender@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
(cherry picked from commit 6976a6f2acde2b0443cd64f1d08af90630e4ce81)
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/ext4/namei.c

index afe3148645215f0c0ace219f0ff28f76284397f7..902f69bef2c7d77068fc4f9ce266d1297fc6836e 100644 (file)
@@ -1457,6 +1457,10 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        frame->at = entries;
        frame->bh = bh;
        bh = bh2;
+
+       ext4_handle_dirty_metadata(handle, dir, frame->bh);
+       ext4_handle_dirty_metadata(handle, dir, bh);
+
        de = do_split(handle,dir, &bh, frame, &hinfo, &retval);
        if (!de) {
                /*
@@ -1465,8 +1469,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
                 * with corrupted filesystem.
                 */
                ext4_mark_inode_dirty(handle, dir);
-               ext4_handle_dirty_metadata(handle, dir, frame->bh);
-               ext4_handle_dirty_metadata(handle, dir, bh);
                dx_release(frames);
                return retval;
        }