Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[patch] tomoyo: fix potential use after free

0 views
Skip to first unread message

Dan Carpenter

unread,
Mar 13, 2010, 6:30:02 AM3/13/10
to
The original code returns a freed pointer. This function is expected to
return NULL on errors.

Signed-off-by: Dan Carpenter <err...@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++)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Tetsuo Handa

unread,
Mar 13, 2010, 7:10:02 AM3/13/10
to
Dan Carpenter wrote:

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

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

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

0 new messages