Skip to contentSkip to conversation

Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL

PATCH In review Horms 2 participants 3 messages Oct 28, 2005 – Oct 29, 2005 VFS

lore
Share & tools
lore

Horms

author
#0 lore raw

PATCH 1/1 Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL

This is CAN-2005-3181, and a backport of 829841146878e082613a49581ae252c071057c23 from Linus's 2.6 tree to 2.4.

Original Description and Sign-Off:

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.

My sign off, indicating I think it applies to 2.4:

fs/namei.c +3 -3
@@ -1198,18 +1198,18 @@ 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);
 	dentry = lookup_hash(&nd->last, nd->dentry);
-	putname(nd->last.name);
+	__putname(nd->last.name);
 	goto do_last;
 }
 
#1 lore raw
Quoted 7 lines · Horms

This is CAN-2005-3181, and a backport of 829841146878e082613a49581ae252c071057c23 from Linus's 2.6 tree to 2.4.

Original Description and Sign-Off:

Avoid 'names_cache' memory leak with CONFIG_AUDITSYSCALL

Quoted 7 lines

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.

My sign off, indicating I think it applies to 2.4:

since there is no such thing as CONFIG_AUDITSYSCALL in any 2.4 kernel, I really think this is entirely NOT relevant to 2.4.....

author
#2 lore raw
Quoted 11 lines · Arjan van de Ven
Quoted 10 lines · Horms

This is CAN-2005-3181, and a backport of 829841146878e082613a49581ae252c071057c23 from Linus's 2.6 tree to 2.4.

Original Description and Sign-Off:

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()".

Quoted 8 lines
Quoted 4 lines

Using "putname()" without the underscores will leak memory, because the allocation will have been hidden from the AUDITSYSCALL code.

My sign off, indicating I think it applies to 2.4:

since there is no such thing as CONFIG_AUDITSYSCALL in any 2.4 kernel, I really think this is entirely NOT relevant to 2.4.....

Thanks, I withdraw the patch.

Signature · 1 line
Horms