summaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-28 03:30:11 +0200
committerTheodore Ts'o <tytso@mit.edu>2010-10-28 03:30:11 +0200
commit877836905da55e8f2426234f42a89287184949e9 (patch)
treeeecb60e9b55daaf794a3083f9c48fc94e05d4cd2 /fs/ext4/mballoc.c
parentext4: use bio layer instead of buffer layer in mpage_da_submit_io (diff)
downloadlinux-877836905da55e8f2426234f42a89287184949e9.tar.xz
linux-877836905da55e8f2426234f42a89287184949e9.zip
ext4: Check return value of sb_getblk() and friends
Fail block allocation if sb_getblk() returns NULL. In that case, sb_find_get_block() also likely to fail so that it should skip calling ext4_forget(). Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to '')
-rw-r--r--fs/ext4/mballoc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d732ef5a835d..611c866ef3fe 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4537,6 +4537,8 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
if (!bh)
tbh = sb_find_get_block(inode->i_sb,
block + i);
+ if (unlikely(!tbh))
+ continue;
ext4_forget(handle, flags & EXT4_FREE_BLOCKS_METADATA,
inode, tbh, block + i);
}