mirror of
https://github.com/joel16/android_kernel_sony_msm8994.git
synced 2024-11-24 12:40:24 +00:00
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>
This commit is contained in:
parent
9623e5a237
commit
570b8fb505
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user