aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-07 00:54:21 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-07 00:54:21 -0400
commit829841146878e082613a49581ae252c071057c23 (patch)
treeb38d26d6c99f043f14242351ac084f8b088a772b /fs
parentedb4a3534adbaf90768d67da35f0bfeac4767db6 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 043d587216b5..aa62dbda93ac 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1551,19 +1551,19 @@ do_link:
1551 if (nd->last_type != LAST_NORM) 1551 if (nd->last_type != LAST_NORM)
1552 goto exit; 1552 goto exit;
1553 if (nd->last.name[nd->last.len]) { 1553 if (nd->last.name[nd->last.len]) {
1554 putname(nd->last.name); 1554 __putname(nd->last.name);
1555 goto exit; 1555 goto exit;
1556 } 1556 }
1557 error = -ELOOP; 1557 error = -ELOOP;
1558 if (count++==32) { 1558 if (count++==32) {
1559 putname(nd->last.name); 1559 __putname(nd->last.name);
1560 goto exit; 1560 goto exit;
1561 } 1561 }
1562 dir = nd->dentry; 1562 dir = nd->dentry;
1563 down(&dir->d_inode->i_sem); 1563 down(&dir->d_inode->i_sem);
1564 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); 1564 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
1565 path.mnt = nd->mnt; 1565 path.mnt = nd->mnt;
1566 putname(nd->last.name); 1566 __putname(nd->last.name);
1567 goto do_last; 1567 goto do_last;
1568} 1568}
1569 1569