]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.13.4/plug-names_cache-memleak.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.13.4 / plug-names_cache-memleak.patch
CommitLineData
645f4605
CW
1From: Linus Torvalds <torvalds@osdl.org>
2Date: Fri, 7 Oct 2005 04:54:21 +0000 (-0700)
3Subject: [PATCH] Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL
4
5Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL
f1731096 6
645f4605
CW
7The nameidata "last.name" is always allocated with "__getname()", and
8should always be free'd with "__putname()".
9
10Using "putname()" without the underscores will leak memory, because the
11allocation will have been hidden from the AUDITSYSCALL code.
12
13Arguably the real bug is that the AUDITSYSCALL code is really broken,
14but in the meantime this fixes the problem people see.
15
16Reported by Robert Derr, patch by Rick Lindsley.
17
18Acked-by: Al Viro <viro@ftp.linux.org.uk>
19Signed-off-by: Linus Torvalds <torvalds@osdl.org>
20Signed-off-by: Chris Wright <chrisw@osdl.org>
f1731096 21Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
645f4605
CW
22---
23 fs/namei.c | 6 +++---
e71f4456 24 1 file changed, 3 insertions(+), 3 deletions(-)
645f4605 25
645f4605
CW
26--- linux-2.6.13.y.orig/fs/namei.c
27+++ linux-2.6.13.y/fs/namei.c
28@@ -1557,19 +1557,19 @@ do_link:
29 if (nd->last_type != LAST_NORM)
30 goto exit;
31 if (nd->last.name[nd->last.len]) {
32- putname(nd->last.name);
33+ __putname(nd->last.name);
34 goto exit;
35 }
36 error = -ELOOP;
37 if (count++==32) {
38- putname(nd->last.name);
39+ __putname(nd->last.name);
40 goto exit;
41 }
42 dir = nd->dentry;
43 down(&dir->d_inode->i_sem);
44 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
45 path.mnt = nd->mnt;
46- putname(nd->last.name);
47+ __putname(nd->last.name);
48 goto do_last;
49 }
50