aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorOskar Schirmer <oskar@scara.com>2010-11-10 16:06:13 -0500
committerSteve French <sfrench@us.ibm.com>2010-11-10 22:40:13 -0500
commita7851ce73b9fdef53f251420e6883cf4f3766534 (patch)
treecbf63df689b3e28769555f294e69b86bbac9981c /fs
parentebe2e91e000c59aed0300d81815f451c85e0bda6 (diff)
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')
-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)
881 rc = cifs_get_inode_info(&inode, full_path, NULL, sb, 881 rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
882 xid, NULL); 882 xid, NULL);
883 883
884 if (!inode) 884 if (!inode) {
885 return ERR_PTR(rc); 885 inode = ERR_PTR(rc);
886 goto out;
887 }
886 888
887#ifdef CONFIG_CIFS_FSCACHE 889#ifdef CONFIG_CIFS_FSCACHE
888 /* populate tcon->resource_id */ 890 /* populate tcon->resource_id */
@@ -898,13 +900,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
898 inode->i_uid = cifs_sb->mnt_uid; 900 inode->i_uid = cifs_sb->mnt_uid;
899 inode->i_gid = cifs_sb->mnt_gid; 901 inode->i_gid = cifs_sb->mnt_gid;
900 } else if (rc) { 902 } else if (rc) {
901 kfree(full_path);
902 _FreeXid(xid);
903 iget_failed(inode); 903 iget_failed(inode);
904 return ERR_PTR(rc); 904 inode = ERR_PTR(rc);
905 } 905 }
906 906
907 907out:
908 kfree(full_path); 908 kfree(full_path);
909 /* can not call macro FreeXid here since in a void func 909 /* can not call macro FreeXid here since in a void func
910 * TODO: This is no longer true 910 * TODO: This is no longer true