]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2: add necessary check in case sb_getblk() fails
authorRui Xiang <rui.xiang@huawei.com>
Tue, 5 Nov 2013 05:55:02 +0000 (16:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 5 Nov 2013 05:55:02 +0000 (16:55 +1100)
sb_getblk() may return an err, so add a check for bh.

Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/refcounttree.c

index 70d083e60d4076a46d782905c50f6653b76c3e0b..55767e1ba72492431dcb3ae9fe204526d93f28d2 100644 (file)
@@ -612,6 +612,11 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
        }
 
        new_bh = sb_getblk(inode->i_sb, first_blkno);
+       if (!new_bh) {
+               ret = -ENOMEM;
+               mlog_errno(ret);
+               goto out_commit;
+       }
        ocfs2_set_new_buffer_uptodate(&new_tree->rf_ci, new_bh);
 
        ret = ocfs2_journal_access_rb(handle, &new_tree->rf_ci, new_bh,