All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] tomoyo: fix potential use after free
@ 2010-03-13 11:14 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-03-13 11:14 UTC (permalink / raw)
  To: Kentaro Takeda
  Cc: Tetsuo Handa, James Morris, Serge Hallyn, Toshiharu Harada,
	linux-security-module, linux-kernel, kernel-janitors

The original code returns a freed pointer.  This function is expected to 
return NULL on errors.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index ff51f10..ef89947 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -886,6 +886,7 @@ static struct tomoyo_profile *tomoyo_find_or_assign_new_profile(const unsigned
 	ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
 	if (!tomoyo_memory_ok(ptr)) {
 		kfree(ptr);
+		ptr = NULL;
 		goto ok;
 	}
 	for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++)

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

* [patch] tomoyo: fix potential use after free
@ 2010-03-13 11:14 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-03-13 11:14 UTC (permalink / raw)
  To: Kentaro Takeda
  Cc: Tetsuo Handa, James Morris, Serge Hallyn, Toshiharu Harada,
	linux-security-module, linux-kernel, kernel-janitors

The original code returns a freed pointer.  This function is expected to 
return NULL on errors.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index ff51f10..ef89947 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -886,6 +886,7 @@ static struct tomoyo_profile *tomoyo_find_or_assign_new_profile(const unsigned
 	ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
 	if (!tomoyo_memory_ok(ptr)) {
 		kfree(ptr);
+		ptr = NULL;
 		goto ok;
 	}
 	for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++)

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

* Re: [patch] tomoyo: fix potential use after free
  2010-03-13 11:14 ` Dan Carpenter
@ 2010-03-13 12:05   ` Tetsuo Handa
  -1 siblings, 0 replies; 4+ messages in thread
From: Tetsuo Handa @ 2010-03-13 12:05 UTC (permalink / raw)
  To: error27, jmorris
  Cc: takedakn, serue, haradats, linux-security-module, linux-kernel,
	kernel-janitors

Dan Carpenter wrote:

> The original code returns a freed pointer.  This function is expected to 
> return NULL on errors.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Oh, thank you.
James, please send this patch to 2.6.34-rc1 .

Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index ff51f10..ef89947 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -886,6 +886,7 @@ static struct tomoyo_profile *tomoyo_find_or_assign_new_profile(const unsigned
>  	ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
>  	if (!tomoyo_memory_ok(ptr)) {
>  		kfree(ptr);
> +		ptr = NULL;
>  		goto ok;
>  	}
>  	for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++)

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

* Re: [patch] tomoyo: fix potential use after free
@ 2010-03-13 12:05   ` Tetsuo Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Tetsuo Handa @ 2010-03-13 12:05 UTC (permalink / raw)
  To: error27, jmorris
  Cc: takedakn, serue, haradats, linux-security-module, linux-kernel,
	kernel-janitors

Dan Carpenter wrote:

> The original code returns a freed pointer.  This function is expected to 
> return NULL on errors.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Oh, thank you.
James, please send this patch to 2.6.34-rc1 .

Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index ff51f10..ef89947 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -886,6 +886,7 @@ static struct tomoyo_profile *tomoyo_find_or_assign_new_profile(const unsigned
>  	ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
>  	if (!tomoyo_memory_ok(ptr)) {
>  		kfree(ptr);
> +		ptr = NULL;
>  		goto ok;
>  	}
>  	for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++)

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

end of thread, other threads:[~2010-03-13 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-13 11:14 [patch] tomoyo: fix potential use after free Dan Carpenter
2010-03-13 11:14 ` Dan Carpenter
2010-03-13 12:05 ` Tetsuo Handa
2010-03-13 12:05   ` Tetsuo Handa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.