kunit: Fix the wrong kfree of copy for kunit_filter_suites()
authorJinjie Ruan <ruanjinjie@huawei.com>
Wed, 27 Sep 2023 09:03:48 +0000 (17:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:15 +0000 (11:59 +0100)
commit421058c75b8339d5d898a8cde36e058cdf85393e
tree223f9dd4f525276d96533789ac609b7a0624c337
parent3fc7c7079f6a6183de8605e7501c368dccd77f7b
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@huawei.com>
Reviewed-by: Rae Moar <rmoar@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/kunit/executor.c