Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 181427a7 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Morris
Browse files

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: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent bca14dd1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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++)