Michel Lespinasse 3d3c8f93a2 binary_sysctl(): fix memory leak
binary_sysctl() calls sysctl_getname() which allocates from names_cache
slab usin __getname()

The matching function to free the name is __putname(), and not putname()
which should be used only to match getname() allocations.

This is because when auditing is enabled, putname() calls audit_putname
*instead* (not in addition) to __putname().  Then, if a syscall is in
progress, audit_putname does not release the name - instead, it expects
the name to get released when the syscall completes, but that will happen
only if audit_getname() was called previously, i.e.  if the name was
allocated with getname() rather than the naked __getname().  So,
__getname() followed by putname() ends up leaking memory.

Signed-off-by: Michel Lespinasse <walken@google.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Eric Paris <eparis@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-20 10:25:04 -08:00
..
2011-07-26 16:49:45 -07:00
2011-12-06 11:38:32 +01:00
2010-08-09 16:48:42 -04:00
2011-03-14 09:15:23 -04:00
2010-10-30 01:42:19 -04:00
2011-09-23 12:05:29 +05:30
2011-07-14 12:59:14 +03:00
2011-10-31 17:30:45 -07:00
2011-12-09 07:50:28 -08:00
2011-03-31 11:26:23 -03:00
2011-04-24 13:18:38 +02:00
2011-10-31 17:30:44 -07:00
2011-08-12 16:21:35 -05:00
2011-09-19 17:04:37 -07:00