Skip to content

Commit

Permalink
tomoyo: fix potential use after free
Browse files Browse the repository at this point in the history
The original code returns a freed pointer.  This function is expected to
return NULL on errors.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Dan Carpenter authored and James Morris committed Mar 14, 2010
1 parent bca14dd commit 181427a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions security/tomoyo/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit 181427a

Please sign in to comment.