]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Add patch to plug names_cache memleak when AUDITSYSCALL is enabled
authorChris Wright <chrisw@osdl.org>
Fri, 7 Oct 2005 22:27:00 +0000 (15:27 -0700)
committerChris Wright <chrisw@osdl.org>
Fri, 7 Oct 2005 22:27:00 +0000 (15:27 -0700)
queue/plug-names_cache-memleak.patch [new file with mode: 0644]
queue/series

diff --git a/queue/plug-names_cache-memleak.patch b/queue/plug-names_cache-memleak.patch
new file mode 100644 (file)
index 0000000..c8ddf0b
--- /dev/null
@@ -0,0 +1,51 @@
+From: Linus Torvalds <torvalds@osdl.org>
+Date: Fri, 7 Oct 2005 04:54:21 +0000 (-0700)
+Subject: [PATCH] Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL
+
+Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL
+  
+The nameidata "last.name" is always allocated with "__getname()", and
+should always be free'd with "__putname()".
+
+Using "putname()" without the underscores will leak memory, because the
+allocation will have been hidden from the AUDITSYSCALL code.
+
+Arguably the real bug is that the AUDITSYSCALL code is really broken,
+but in the meantime this fixes the problem people see.
+
+Reported by Robert Derr, patch by Rick Lindsley.
+
+Acked-by: Al Viro <viro@ftp.linux.org.uk>
+Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+Signed-off-by: Chris Wright <chrisw@osdl.org>
+---
+ fs/namei.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+Index: linux-2.6.13.y/fs/namei.c
+===================================================================
+--- linux-2.6.13.y.orig/fs/namei.c
++++ linux-2.6.13.y/fs/namei.c
+@@ -1557,19 +1557,19 @@ do_link:
+       if (nd->last_type != LAST_NORM)
+               goto exit;
+       if (nd->last.name[nd->last.len]) {
+-              putname(nd->last.name);
++              __putname(nd->last.name);
+               goto exit;
+       }
+       error = -ELOOP;
+       if (count++==32) {
+-              putname(nd->last.name);
++              __putname(nd->last.name);
+               goto exit;
+       }
+       dir = nd->dentry;
+       down(&dir->d_inode->i_sem);
+       path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
+       path.mnt = nd->mnt;
+-      putname(nd->last.name);
++      __putname(nd->last.name);
+       goto do_last;
+ }
index 8273aa286fe89d976588b11bf17690e484a6a429..8655b4e7bd0c0e056663e0de2b9ebda59bf22cbe 100644 (file)
@@ -3,3 +3,4 @@ orinoco-info-leak.patch
 tcp-congestion-control-bug.patch
 drm-module_param-permissions-fix.patch
 fix-sparc64-fpu-register-corruption.patch
+plug-names_cache-memleak.patch