public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] kunit: Fix some bugs in kunit
@ 2023-09-22  7:10 Jinjie Ruan
  2023-09-22  7:10 ` [PATCH v3 1/4] kunit: Fix missed memory release in kunit_free_suite_set() Jinjie Ruan
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jinjie Ruan @ 2023-09-22  7:10 UTC (permalink / raw)
  To: brendan.higgins, davidgow, skhan, dlatypov, rmoar,
	janusz.krzysztofik, linux-kselftest, kunit-dev
  Cc: ruanjinjie

The test_cases is not freed in kunit_free_suite_set().

And the copy pointer may be moved in kunit_filter_suites().

The filtered_suite and filtered_suite->test_cases allocated in the last
kunit_filter_attr_tests() in last inner for loop may be leaked if
kunit_filter_suites() fails.

If kunit_filter_suites() succeeds, not only copy but also filtered_suite
and filtered_suite->test_cases should be freed.

Changes in v3:
- Update the kfree_at_end() to use kunit_free_suite_set() for 4th patch.
- Update the commit message for the 4th patch.

Changes in v2:
- Add Reviewed-by.
- Add the memory leak backtrace for the 4th patch.
- Remove the unused func kernel test robot noticed for the 4th patch.
- Update the commit message for the 4th patch.

Jinjie Ruan (4):
  kunit: Fix missed memory release in kunit_free_suite_set()
  kunit: Fix the wrong kfree of copy for kunit_filter_suites()
  kunit: Fix possible memory leak in kunit_filter_suites()
  kunit: test: Fix the possible memory leak in executor_test

 lib/kunit/executor.c      | 23 +++++++++++++++++------
 lib/kunit/executor_test.c | 35 ++++++++++++++++++++++-------------
 2 files changed, 39 insertions(+), 19 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-26 23:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22  7:10 [PATCH v3 0/4] kunit: Fix some bugs in kunit Jinjie Ruan
2023-09-22  7:10 ` [PATCH v3 1/4] kunit: Fix missed memory release in kunit_free_suite_set() Jinjie Ruan
2023-09-22  7:47   ` David Gow
2023-09-22  7:10 ` [PATCH v3 2/4] kunit: Fix the wrong kfree of copy for kunit_filter_suites() Jinjie Ruan
2023-09-22  7:47   ` David Gow
2023-09-22  7:10 ` [PATCH v3 3/4] kunit: Fix possible memory leak in kunit_filter_suites() Jinjie Ruan
2023-09-22  7:47   ` David Gow
2023-09-22  7:10 ` [PATCH v3 4/4] kunit: test: Fix the possible memory leak in executor_test Jinjie Ruan
2023-09-22  7:47   ` David Gow
2023-09-26 21:14   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox