CRED: Missing put_cred() in prepare_kernel_cred()
PATCH 1/2 CRED: Missing put_cred() in prepare_kernel_cred()
Missing put_cred() in the error handling path of prepare_kernel_cred().
Signed-off-by David Howells <[email protected]>
Acked-by Steve Dickson <[email protected]>
---
kernel/cred.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/cred.c +1 -0
@@ -530,6 +530,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) error:put_cred (new); +put_cred (old);return NULL ; }EXPORT_SYMBOL (prepare_kernel_cred);
PATCH 2/2 CRED: Must initialise the new creds in prepare_kernel_cred()
The newly allocated creds in prepare_kernel_cred() must be initialised before get_uid() and get_group_info() can access them. They should be copied from the old credentials.
Reported-by Steve Dickson <[email protected]>
Signed-off-by David Howells <[email protected]>
Acked-by Steve Dickson <[email protected]>
---
kernel/cred.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/cred.c +1 -0
@@ -507,6 +507,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon)else old =get_cred (&init_cred); + *new = *old;get_uid (new->user);get_group_info (new->group_info);