The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	kunit-dev@googlegroups.com,
	Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
	Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH] kunit: irq: Unregister on-stack timer and work from debugobjects
Date: Wed,  5 Aug 2026 22:38:04 -0700	[thread overview]
Message-ID: <20260806053804.106724-1-ebiggers@kernel.org> (raw)

In kunit_run_irq_test(), call destroy_hrtimer_on_stack() and
destroy_work_on_stack() to unregister the hrtimer and work from the
debugobjects infrastructure (when CONFIG_DEBUG_OBJECTS_TIMERS=y and
CONFIG_DEBUG_OBJECTS_WORK=y) before the function returns.

Found via code review; the lack of the unregistrations didn't actually
cause a warning, since the objects are inactive upon return anyway.  But
they should be there, otherwise debugobjects keeps tracking the objects.

Fixes: 950a81224e8b ("lib/crypto: tests: Add hash-test-template.h and gen-hash-testvecs.py")
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---

This patch is targeting libcrypto-next

 include/kunit/run-in-irq-context.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/kunit/run-in-irq-context.h b/include/kunit/run-in-irq-context.h
index 3802b6fb218ed..b46fa1696360c 100644
--- a/include/kunit/run-in-irq-context.h
+++ b/include/kunit/run-in-irq-context.h
@@ -137,6 +137,8 @@ static inline void kunit_run_irq_test(struct kunit *test, bool (*func)(void *),
 	/* Cancel the timer and work. */
 	hrtimer_cancel(&state.timer);
 	flush_work(&state.bh_work);
+	destroy_hrtimer_on_stack(&state.timer);
+	destroy_work_on_stack(&state.bh_work);
 
 	/* Sanity check: the timer and BH functions should have been run. */
 	KUNIT_EXPECT_GT_MSG(test, atomic_read(&state.hardirq_func_calls), 0,

base-commit: 4bceb5614e0fc0338d6787f39df5472bfd72eaab
-- 
2.55.0


             reply	other threads:[~2026-08-06  5:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  5:38 Eric Biggers [this message]
2026-08-06 11:36 ` [PATCH] kunit: irq: Unregister on-stack timer and work from debugobjects David Gow
2026-08-07 22:04 ` Eric Biggers

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=20260806053804.106724-1-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=david@davidgow.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raemoar63@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox