Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Mathieu Desnoyers and committed by
James Morris
570b8fb5 9623e5a2

+5 -1
+5 -1
kernel/cred.c
··· 364 364 365 365 new = kmem_cache_alloc(cred_jar, GFP_ATOMIC); 366 366 if (!new) 367 - return NULL; 367 + goto free_tgcred; 368 368 369 369 kdebug("prepare_usermodehelper_creds() alloc %p", new); 370 370 ··· 397 397 398 398 error: 399 399 put_cred(new); 400 + free_tgcred: 401 + #ifdef CONFIG_KEYS 402 + kfree(tgcred); 403 + #endif 400 404 return NULL; 401 405 } 402 406