diff options
author | Bob Peterson <rpeterso@redhat.com> | 2017-07-18 12:26:07 -0500 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2017-07-21 08:20:57 -0500 |
commit | a064050599b87320f5968fcf1b6f0a36e380f714 (patch) | |
tree | d9b5b17d40a06c77caecf6f99cdc782b2226f3a6 /fs | |
parent | 4d7c18c7df89ef549f2de79b0faf873b49dea57a (diff) |
GFS2: Clear gl_object if gfs2_create_inode fails
If function gfs2_create_inode fails after the inode has been
created (for example, if the inode_refresh fails for some reason)
the function was setting gl_object but never clearing it again.
The glocks are left pointing to a freed inode. This patch adds
the calls to clear gl_object in the appropriate error paths.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/inode.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index fd6e1da3c5ab..5d40dcb0ea06 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -775,11 +775,13 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, return error; fail_gunlock3: + glock_clear_object(io_gl, ip); gfs2_glock_dq_uninit(&ip->i_iopen_gh); gfs2_glock_put(io_gl); fail_gunlock2: if (io_gl) clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags); + glock_clear_object(ip->i_gl, ip); fail_free_inode: if (ip->i_gl) gfs2_glock_put(ip->i_gl); |