summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2023-09-27 12:03:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 13:59:15 +0300
commit421058c75b8339d5d898a8cde36e058cdf85393e (patch)
tree223f9dd4f525276d96533789ac609b7a0624c337 /lib
parent3fc7c7079f6a6183de8605e7501c368dccd77f7b (diff)
downloadlinux-421058c75b8339d5d898a8cde36e058cdf85393e.tar.xz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/kunit/executor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
index a037a46fae5e..9358ed2df839 100644
--- a/lib/kunit/executor.c
+++ b/lib/kunit/executor.c
@@ -243,7 +243,7 @@ free_parsed_glob:
free_copy:
if (*err)
- kfree(copy);
+ kfree(copy_start);
return filtered;
}