GFS2: add error check while allocating new inodes
authorBob Peterson <rpeterso@redhat.com>
Fri, 16 Nov 2012 14:11:39 +0000 (09:11 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 16 Nov 2012 14:26:57 +0000 (14:26 +0000)
This patch adds a return code check after attempting to allocate
a new inode during dinode creation.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/inode.c

index e321333..2405695 100644 (file)
@@ -674,6 +674,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
                goto fail_gunlock;
 
        inode = new_inode(sdp->sd_vfs);
+       if (!inode) {
+               gfs2_glock_dq_uninit(ghs);
+               return -ENOMEM;
+       }
        ip = GFS2_I(inode);
        error = gfs2_rs_alloc(ip);
        if (error)