Tetsuo Handa fb2b2a1d37 CRED: Fix memory and refcount leaks upon security_prepare_creds() failure
In prepare_kernel_cred() since 2.6.29, put_cred(new) is called without
assigning new->usage when security_prepare_creds() returned an error.  As a
result, memory for new and refcount for new->{user,group_info,tgcred} are
leaked because put_cred(new) won't call __put_cred() unless old->usage == 1.

Fix these leaks by assigning new->usage (and new->subscribers which was added
in 2.6.32) before calling security_prepare_creds().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-02-07 14:04:00 -08:00
..
2010-12-22 18:57:02 +01:00
2010-08-09 16:48:42 -04:00
2010-07-14 11:29:46 +02:00
2010-10-30 01:42:19 -04:00
2010-11-03 13:49:58 -04:00
2010-10-30 01:42:19 -04:00
2010-10-30 08:45:43 -04:00
2010-10-29 04:17:06 -04:00
2009-09-18 09:48:52 -07:00
2011-01-13 17:32:43 -08:00
2010-12-16 11:36:43 +01:00
2010-11-01 15:38:34 -04:00
2010-10-01 10:50:58 -07:00
2010-08-19 17:18:02 -07:00
2010-11-18 13:27:46 +01:00
2011-02-03 12:21:33 +01:00
2011-01-31 13:01:27 +10:00
2009-09-23 18:13:10 -07:00
2010-12-29 11:31:38 -08:00
2009-06-18 13:03:55 -07:00