diff options
author | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2010-03-30 00:04:00 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-03-30 17:15:38 +1100 |
commit | 570b8fb505896e007fd3bb07573ba6640e51851d (patch) | |
tree | fd36f685aa2028628605733708bbf7d1af62f3ec /kernel/cred.c | |
parent | 9623e5a23724d09283c238960946ec6f65733afe (diff) | |
download | linux-570b8fb505896e007fd3bb07573ba6640e51851d.tar.gz linux-570b8fb505896e007fd3bb07573ba6640e51851d.tar.bz2 linux-570b8fb505896e007fd3bb07573ba6640e51851d.zip |
CRED: Fix memory leak in error handling
Fix a memory leak on an OOM condition in prepare_usermodehelper_creds().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel/cred.c')
-rw-r--r-- | kernel/cred.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/cred.c b/kernel/cred.c index 1ed8ca18790c..1b1129d0cce8 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -364,7 +364,7 @@ struct cred *prepare_usermodehelper_creds(void) new = kmem_cache_alloc(cred_jar, GFP_ATOMIC); if (!new) - return NULL; + goto free_tgcred; kdebug("prepare_usermodehelper_creds() alloc %p", new); @@ -397,6 +397,10 @@ struct cred *prepare_usermodehelper_creds(void) error: put_cred(new); +free_tgcred: +#ifdef CONFIG_KEYS + kfree(tgcred); +#endif return NULL; } |