From: Rui Xiang Date: Tue, 5 Nov 2013 05:55:02 +0000 (+1100) Subject: ocfs2: add necessary check in case sb_getblk() fails X-Git-Tag: next-20131105~2^2~311 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=92782f54c74897b1b8c8eff7191fc66ecf0c1007;p=karo-tx-linux.git ocfs2: add necessary check in case sb_getblk() fails sb_getblk() may return an err, so add a check for bh. Signed-off-by: Rui Xiang Reviewed-by: Jie Liu Reviewed-by: Mark Fasheh Cc: Joel Becker Signed-off-by: Andrew Morton --- diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 70d083e60d40..55767e1ba724 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -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,