summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorOskar Schirmer <oskar@scara.com>2010-11-10 21:06:13 +0000
committerSteve French <sfrench@us.ibm.com>2010-11-11 03:40:13 +0000
commita7851ce73b9fdef53f251420e6883cf4f3766534 (patch)
treecbf63df689b3e28769555f294e69b86bbac9981c /fs/cifs
parentebe2e91e000c59aed0300d81815f451c85e0bda6 (diff)
downloadlinux-a7851ce73b9fdef53f251420e6883cf4f3766534.tar.bz2
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: Oskar Schirmer <oskar@scara.com> Reviewed-by: Jesper Juhl <jj@chaosbits.net> Cc: stable@kernel.org Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/inode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index ef3a55bf86b6..ff7d2995d252 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -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,
xid, NULL);
- if (!inode)
- return ERR_PTR(rc);
+ if (!inode) {
+ inode = ERR_PTR(rc);
+ goto out;
+ }
#ifdef CONFIG_CIFS_FSCACHE
/* populate tcon->resource_id */
@@ -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_gid = cifs_sb->mnt_gid;
} else if (rc) {
- kfree(full_path);
- _FreeXid(xid);
iget_failed(inode);
- return ERR_PTR(rc);
+ inode = ERR_PTR(rc);
}
-
+out:
kfree(full_path);
/* can not call macro FreeXid here since in a void func
* TODO: This is no longer true