From: Kery Qi <qikeyu2017@gmail.com>
To: andrii@kernel.org
Cc: martin.lau@linux.dev, bpf@vger.kernel.org,
Kery Qi <qikeyu2017@gmail.com>
Subject: [PATCH] selftests/bpf: wq: fix skel leak in serial_test_wq()
Date: Mon, 12 Jan 2026 01:58:14 +0800 [thread overview]
Message-ID: <20260111175813.2252-2-qikeyu2017@gmail.com> (raw)
serial_test_wq() returns early when ASSERT_OK_PTR(wq_skel, "wq_skel_load")
fails. In that case wq__open_and_load() may still have returned a non-NULL
skeleton, and the early return skips wq__destroy(), leaking resources and
triggering ASAN leak reports in selftests runs.
Jump to the common clean_up label instead, so wq__destroy() is executed on
all exit paths. Also fix the missing semicolon after 'goto clean_up'.
Fixes: 8290dba51910 ("selftests/bpf: wq: add bpf_wq_start() checks")
Signed-off-by: Kery Qi <qikeyu2017@gmail.com>
---
tools/testing/selftests/bpf/prog_tests/wq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/wq.c b/tools/testing/selftests/bpf/prog_tests/wq.c
index 1dcdeda84853..328c393e7167 100644
--- a/tools/testing/selftests/bpf/prog_tests/wq.c
+++ b/tools/testing/selftests/bpf/prog_tests/wq.c
@@ -17,7 +17,7 @@ void serial_test_wq(void)
wq_skel = wq__open_and_load();
if (!ASSERT_OK_PTR(wq_skel, "wq_skel_load"))
- return;
+ goto clean_up;
err = wq__attach(wq_skel);
if (!ASSERT_OK(err, "wq_attach"))
--
2.34.1
next reply other threads:[~2026-01-11 17:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-11 17:58 Kery Qi [this message]
2026-01-11 18:20 ` [PATCH] selftests/bpf: wq: fix skel leak in serial_test_wq() bot+bpf-ci
2026-01-13 15:13 ` Mykyta Yatsenko
-- strict thread matches above, loose matches on Subject: below --
2026-01-11 18:30 Kery Qi
2026-01-12 6:17 ` Yonghong Song
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=20260111175813.2252-2-qikeyu2017@gmail.com \
--to=qikeyu2017@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=martin.lau@linux.dev \
/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.