All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: <brendan.higgins@linux.dev>, <davidgow@google.com>,
	<skhan@linuxfoundation.org>, <dlatypov@google.com>,
	<rmoar@google.com>, <janusz.krzysztofik@linux.intel.com>,
	<linux-kselftest@vger.kernel.org>, <kunit-dev@googlegroups.com>
Cc: <ruanjinjie@huawei.com>
Subject: [PATCH v3 0/4] kunit: Fix some bugs in kunit
Date: Fri, 22 Sep 2023 15:10:16 +0800	[thread overview]
Message-ID: <20230922071020.2554677-1-ruanjinjie@huawei.com> (raw)

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


             reply	other threads:[~2023-09-22  7:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22  7:10 Jinjie Ruan [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230922071020.2554677-1-ruanjinjie@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=janusz.krzysztofik@linux.intel.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rmoar@google.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.