提交 570b8fb5 编写于 作者: M Mathieu Desnoyers 提交者: James Morris

CRED: Fix memory leak in error handling

Fix a memory leak on an OOM condition in prepare_usermodehelper_creds().
Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 9623e5a2
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册