Commit a7851ce7 authored by Oskar Schirmer's avatar Oskar Schirmer Committed by Steve French

cifs: fix another memleak, in cifs_root_iget

cifs_root_iget allocates full_path through
cifs_build_path_to_root, but fails to kfree it upon
cifs_get_inode_info* failure.

Make all failure exit paths traverse clean up
handling at the end of the function.
Signed-off-by: default avatarOskar Schirmer <oskar@scara.com>
Reviewed-by: default avatarJesper Juhl <jj@chaosbits.net>
Cc: stable@kernel.org
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent ebe2e91e
...@@ -881,8 +881,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) ...@@ -881,8 +881,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
rc = cifs_get_inode_info(&inode, full_path, NULL, sb, rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
xid, NULL); xid, NULL);
if (!inode) if (!inode) {
return ERR_PTR(rc); inode = ERR_PTR(rc);
goto out;
}
#ifdef CONFIG_CIFS_FSCACHE #ifdef CONFIG_CIFS_FSCACHE
/* populate tcon->resource_id */ /* populate tcon->resource_id */
...@@ -898,13 +900,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) ...@@ -898,13 +900,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
inode->i_uid = cifs_sb->mnt_uid; inode->i_uid = cifs_sb->mnt_uid;
inode->i_gid = cifs_sb->mnt_gid; inode->i_gid = cifs_sb->mnt_gid;
} else if (rc) { } else if (rc) {
kfree(full_path);
_FreeXid(xid);
iget_failed(inode); iget_failed(inode);
return ERR_PTR(rc); inode = ERR_PTR(rc);
} }
out:
kfree(full_path); kfree(full_path);
/* can not call macro FreeXid here since in a void func /* can not call macro FreeXid here since in a void func
* TODO: This is no longer true * TODO: This is no longer true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment