summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-30 07:26:30 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-30 07:26:30 -0700
commit246750ffa1b26335df4e485b4e4d28d83756ac43 (patch)
tree8c28306f1b66bd89713c9dfe8738097d56056d06 /kernel
parent4660d3d240ac6c92cd3ad33657ca302026bdc24b (diff)
parent570b8fb505896e007fd3bb07573ba6640e51851d (diff)
downloadlinux-246750ffa1b26335df4e485b4e4d28d83756ac43.tar.bz2
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: CRED: Fix memory leak in error handling
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cred.c6
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;
}