The state handle in kunit_module_notify() is not correct when the mod->state switch from MODULE_STATE_COMING to MODULE_STATE_GOING. And it's necessary to check NULL for kzalloc() in kunit_parse_glob_filter(). The order in which memory is released in err path in kunit_filter_suites() is also problematic. And there is a possible memory leak in kunit_filter_suites(). This patchset fix the above issues. Changes in v2: - Adjust the 4th patch to be the second. - Add goto labels in kunit_filter_suites() and adapt to it. - Fix the issue in the third patch. - Update the commit message and title. Jinjie Ruan (4): kunit: Fix wild-memory-access bug in kunit_free_suite_set() kunit: Fix the wrong err path and add goto labels in kunit_filter_suites() kunit: Fix possible null-ptr-deref in kunit_parse_glob_filter() kunit: Fix possible memory leak in kunit_filter_suites() lib/kunit/executor.c | 48 ++++++++++++++++++++++++++++++-------------- lib/kunit/test.c | 3 ++- 2 files changed, 35 insertions(+), 16 deletions(-) -- 2.34.1