]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2-add-necessary-check-in-case-sb_getblk-fails-update
authorJoseph Qi <joseph.qi@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)
Need also add a check after calling sb_getblk in ocfs2_create_xattr_block.

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

index 82257299d5eacb2604e902d2fab39d7d33cbc717..f0a1326d9bba89812f5ae736938ca3cfbee1284d 100644 (file)
@@ -2864,6 +2864,12 @@ static int ocfs2_create_xattr_block(struct inode *inode,
        }
 
        new_bh = sb_getblk(inode->i_sb, first_blkno);
+       if (!new_bh) {
+               ret = -ENOMEM;
+               mlog_errno(ret);
+               goto end;
+       }
+
        ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh);
 
        ret = ocfs2_journal_access_xb(ctxt->handle, INODE_CACHE(inode),