* [patch] tomoyo: fix potential use after free
@ 2010-03-13 11:14 Dan Carpenter
2010-03-13 12:05 ` Tetsuo Handa
0 siblings, 1 reply; 2+ 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] 2+ messages in thread
* Re: [patch] tomoyo: fix potential use after free
2010-03-13 11:14 [patch] tomoyo: fix potential use after free Dan Carpenter
@ 2010-03-13 12:05 ` Tetsuo Handa
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
end of thread, other threads:[~2010-03-13 12:05 UTC | newest]
Thread overview: 2+ 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 12:05 ` Tetsuo Handa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox