mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] CRED: Missing put_cred() in prepare_kernel_cred()
@ 2009-01-09 16:13 David Howells
  2009-01-09 16:13 ` [PATCH 2/2] CRED: Must initialise the new creds " David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2009-01-09 16:13 UTC (permalink / raw)
  To: torvalds, jmorris, akpm
  Cc: dhowells, steved, linux-kernel, linux-security-module

Missing put_cred() in the error handling path of prepare_kernel_cred().

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
---

 kernel/cred.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/cred.c b/kernel/cred.c
index 480a61a..400e608 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] CRED: Must initialise the new creds in prepare_kernel_cred()
  2009-01-09 16:13 [PATCH 1/2] CRED: Missing put_cred() in prepare_kernel_cred() David Howells
@ 2009-01-09 16:13 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2009-01-09 16:13 UTC (permalink / raw)
  To: torvalds, jmorris, akpm
  Cc: dhowells, steved, linux-kernel, linux-security-module

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 <steved@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
---

 kernel/cred.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/cred.c b/kernel/cred.c
index 400e608..3a03918 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -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);
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-09 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-09 16:13 [PATCH 1/2] CRED: Missing put_cred() in prepare_kernel_cred() David Howells
2009-01-09 16:13 ` [PATCH 2/2] CRED: Must initialise the new creds " David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®