Commit ce44eeb6 authored by Davi Arnaut's avatar Davi Arnaut Committed by Linus Torvalds
Browse files

[PATCH] V9FS: 'names_cache' memory leak



Data allocated with "__getname()" should always be free'd with "__putname()"
because of the AUDITSYSCALL code.
Signed-off-by: default avatarDavi Arnaut <davi.arnaut@gmail.com>
Cc: <rminnich@lanl.gov>
Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent be586bab
...@@ -266,7 +266,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses, ...@@ -266,7 +266,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
v9ses->remotename = __getname(); v9ses->remotename = __getname();
if (!v9ses->remotename) { if (!v9ses->remotename) {
putname(v9ses->name); __putname(v9ses->name);
return -ENOMEM; return -ENOMEM;
} }
...@@ -411,8 +411,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) ...@@ -411,8 +411,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
if (v9ses->transport) if (v9ses->transport)
v9ses->transport->close(v9ses->transport); v9ses->transport->close(v9ses->transport);
putname(v9ses->name); __putname(v9ses->name);
putname(v9ses->remotename); __putname(v9ses->remotename);
} }
/** /**
......
...@@ -1105,7 +1105,7 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer, ...@@ -1105,7 +1105,7 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer,
} }
} }
putname(link); __putname(link);
return retval; return retval;
} }
...@@ -1129,7 +1129,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -1129,7 +1129,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
len = v9fs_readlink(dentry, link, strlen(link)); len = v9fs_readlink(dentry, link, strlen(link));
if (len < 0) { if (len < 0) {
putname(link); __putname(link);
link = ERR_PTR(len); link = ERR_PTR(len);
} else } else
link[len] = 0; link[len] = 0;
...@@ -1152,7 +1152,7 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void ...@@ -1152,7 +1152,7 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void
dprintk(DEBUG_VFS, " %s %s\n", dentry->d_name.name, s); dprintk(DEBUG_VFS, " %s %s\n", dentry->d_name.name, s);
if (!IS_ERR(s)) if (!IS_ERR(s))
putname(s); __putname(s);
} }
/** /**
...@@ -1228,7 +1228,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -1228,7 +1228,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
FreeMem: FreeMem:
kfree(mistat); kfree(mistat);
kfree(fcall); kfree(fcall);
putname(symname); __putname(symname);
return retval; return retval;
} }
...@@ -1319,7 +1319,7 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1319,7 +1319,7 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
FreeMem: FreeMem:
kfree(mistat); kfree(mistat);
kfree(fcall); kfree(fcall);
putname(symname); __putname(symname);
return retval; return retval;
} }
......
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