mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
tomoyo: fix potential use after free
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>
This commit is contained in:
parent
bca14dd14f
commit
181427a7e0
1 changed files with 1 additions and 0 deletions
|
@ -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++)
|
||||
|
|
Loading…
Reference in a new issue