From: sashiko-bot@kernel.org
To: "Theodore Ts'o" <tytso@mit.edu>,
"Ext4 Developers List" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH -v2 09/26] ext4: add KUnit tests for fs/ext4/ialloc.c
Date: Thu, 19 Nov 2026 16:13:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-223496@kernel.org> (raw)
In-Reply-To: <20261119155658.1940864-10-tytso@mit.edu>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ext4: leak of ctx and locked sb in ialloc_test_init() on
allocation failure
--
commit 1c66a229567b11dc0a2eee47f9e0bdd4aba440b8
Author: Theodore Ts'o <tytso@mit.edu>
ext4: add KUnit tests for fs/ext4/ialloc.c
This commit adds the ext4_ialloc_test KUnit test suite in
fs/ext4/ialloc-test.c along with static stub hooks and symbol exports to
exercise inode allocation, freeing, bitmap management, and group selection
heuristics in fs/ext4/ialloc.c.
> diff --git a/fs/ext4/ialloc-test.c b/fs/ext4/ialloc-test.c
> new file mode 100644
> index 0000000000000..c68b60c959614
> --- /dev/null
> +++ b/fs/ext4/ialloc-test.c
[ ... ]
> +static int ialloc_test_init(struct kunit *test)
> +{
[ ... ]
> + ctx = kzalloc_obj(*ctx);
> + KUNIT_ASSERT_NOT_NULL(test, ctx);
> + test->priv = ctx;
> +
> + fc = fs_context_for_mount(&ialloc_test_fs_type, 0);
> + if (IS_ERR(fc)) {
> + err = PTR_ERR(fc);
> + kfree(ctx);
> + KUNIT_ASSERT_EQ(test, err, 0);
> + }
> + sb = sget_fc(fc, NULL, set_anon_super_fc);
> + put_fs_context(fc);
> + if (IS_ERR(sb)) {
> + err = PTR_ERR(sb);
> + kfree(ctx);
> + KUNIT_ASSERT_EQ(test, err, 0);
> + }
> + ctx->sb = sb;
[ ... ]
> + /* Wire RCU-indexed group_info and flex_groups tables */
> + for (g = 0; g < IALLOC_TEST_NGROUPS; g++) {
> + struct ialloc_test_blk *iblk, *bblk;
> + u32 free_inos = (g == 0) ? IALLOC_TEST_BG0_FREE_INODES :
> + IALLOC_TEST_INODES_PER_GRP;
> +
> + ctx->grp_infos[g] = kunit_kzalloc(test,
> + sizeof(*ctx->grp_infos[g]),
> + GFP_KERNEL);
> + KUNIT_ASSERT_NOT_NULL(test, ctx->grp_infos[g]);
[Severity: Low]
Does KUNIT_ASSERT_NOT_NULL() leak ctx and leave sb active with s_umount
write-locked if kunit_kzalloc() fails?
ialloc_test_cleanup() is not registered until kunit_add_action_or_reset()
at the end of ialloc_test_init(), so aborting here skips the
deactivate_locked_super(sb) and kfree(ctx) cleanup that the subsequent
error paths in this function perform.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119155658.1940864-1-tytso@mit.edu?part=9
next prev parent reply other threads:[~2026-11-19 16:13 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 15:56 [PATCH -v2 00/26] ext4: add lots of KUnit tests! Theodore Ts'o
2026-11-19 15:56 ` [PATCH -v2 01/26] ext4: add KUinit tests for fs/ext4/extents_status.c Theodore Ts'o
2026-11-19 16:05 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 02/26] ext4: add KUnit tests for fs/ext4/extents.c Theodore Ts'o
2026-11-19 16:19 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 03/26] ext4: add KUnit tests for fs/ext4/xattr.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 04/26] ext4: add KUnit tests for fs/ext4/namei.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 05/26] ext4: expand KUnit tests for fs/ext4/mballoc.c Theodore Ts'o
2026-11-19 16:08 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 06/26] ext4: add KUnit tests for fs/ext4/inline.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 07/26] ext4: add KUnit tests for fs/ext4/fast_commit.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 08/26] ext4: expand KUnit tests for fs/ext4/inode.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 09/26] ext4: add KUnit tests for fs/ext4/ialloc.c Theodore Ts'o
2026-11-19 16:13 ` sashiko-bot [this message]
2026-11-19 15:56 ` [PATCH -v2 10/26] ext4: add KUnit tests for fs/ext4/balloc.c Theodore Ts'o
2026-11-19 16:06 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 11/26] ext4: add KUnit tests for fs/ext4/orphan.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 12/26] ext4: add KUnit tests for fs/ext4/block_validity.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 13/26] ext4: check multi-block overlap on left traversal in add_system_zone() Theodore Ts'o
2026-11-19 16:00 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 14/26] ext4: enable full feature coverage in fs/ext4/.kunitconfig Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 15/26] ext4: add KUnit tests for fs/ext4/super.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 16/26] ext4: add KUnit tests for fs/ext4/sysfs.c Theodore Ts'o
2026-11-19 16:08 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 17/26] ext4: add KUnit tests for fs/ext4/ioctl.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 18/26] ext4: add KUnit tests for fs/ext4/resize.c Theodore Ts'o
2026-11-19 16:16 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 19/26] ext4: add KUnit tests for fs/ext4/migrate.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 20/26] ext4: add KUnit tests for fs/ext4/indirect.c Theodore Ts'o
2026-11-19 16:16 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 21/26] ext4: expand KUnit tests in fs/ext4/extents-test.c for file range operations Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 22/26] ext4: add KUnit tests for fs/ext4/fsmap.c Theodore Ts'o
2026-11-19 16:13 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 23/26] ext4: add KUnit tests for fs/ext4/move_extent.c Theodore Ts'o
2026-11-19 16:14 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 24/26] ext4: add KUnit tests for fs/ext4/mmp.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 25/26] ext4: add KUnit tests for fs/ext4/dir.c Theodore Ts'o
2026-11-19 16:17 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 26/26] ext4: add KUnit regression tests for inode migration fixes Theodore Ts'o
2026-11-19 16:15 ` sashiko-bot
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=sashiko-outbox-223496@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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