This is a note to let you know that I've just added the patch titled kunit: Fix the wrong kfree of copy for kunit_filter_suites() to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kunit-fix-the-wrong-kfree-of-copy-for-kunit_filter_s.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 0bc28898122d9f272c468dbcbb5bcde9f5b373da Author: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Date: Wed Sep 27 17:03:48 2023 +0800 kunit: Fix the wrong kfree of copy for kunit_filter_suites() [ Upstream commit e44679515a7b803cf0143dc9de3d2ecbe907f939 ] If the outer layer for loop is iterated more than once and it fails not in the first iteration, the copy pointer has been moved. So it should free the original copy's backup copy_start. Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()") Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Reviewed-by: Rae Moar <rmoar@xxxxxxxxxx> Reviewed-by: David Gow <davidgow@xxxxxxxxxx> Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c index a037a46fae5ea..9358ed2df8395 100644 --- a/lib/kunit/executor.c +++ b/lib/kunit/executor.c @@ -243,7 +243,7 @@ kunit_filter_suites(const struct kunit_suite_set *suite_set, free_copy: if (*err) - kfree(copy); + kfree(copy_start); return filtered; }