aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorOskar Schirmer <oskar@scara.com>2010-11-10 21:06:13 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-09 15:55:35 -0700
commit889491211b81de723effd26cbdd4b4b5b3e1e262 (patch)
treed4a510dd0b4f176795a84461308fea1c658222e6 /fs
parent04333e7c8fcee3212f21b0c431de3f454e3775f3 (diff)
cifs: fix another memleak, in cifs_root_iget
commit a7851ce73b9fdef53f251420e6883cf4f3766534 upstream. 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> Signed-off-by: Andi Kleen <ak@linux.intel.com> Reviewed-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Steve French <sfrench@us.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 303fd7f4dfe..33fa04954f6 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -688,8 +688,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(-ENOMEM);
+ if (!inode) {
+ inode = ERR_PTR(rc);
+ goto out;
+ }
if (rc && cifs_sb->tcon->ipc) {
cFYI(1, ("ipc connection - fake read inode"));
@@ -700,13 +702,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