All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Ye Bin <yebin@huaweicloud.com>,
	tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org
Cc: jack@suse.cz
Subject: Re: [PATCH -next 5/8] ext4: fix miss free super_block in extents_kunit_exit()
Date: Fri, 13 Mar 2026 17:33:15 +0530	[thread overview]
Message-ID: <tsukszr0.ritesh.list@gmail.com> (raw)
In-Reply-To: <20260310130412.3156753-6-yebin@huaweicloud.com>

Ye Bin <yebin@huaweicloud.com> writes:

> From: Ye Bin <yebin10@huawei.com>
>
> There's issue as follows:
> ODEBUG: free active (active state 0) object: ffff88812f2d68a0 object type: percpu_counter hint: 0x0
>  <TASK>
>  debug_check_no_obj_freed+0x3d9/0x4d0
>  kfree+0x2bb/0x6c0
>  extents_kunit_exit+0x65/0x90 [ext4_test]
>  kunit_try_run_case_cleanup+0xbc/0x100 [kunit]
>  kunit_generic_run_threadfn_adapter+0x89/0x100 [kunit]
>  kthread+0x408/0x540
>  ret_from_fork+0xa76/0xdf0
>  ret_from_fork_asm+0x1a/0x30
>
> The above issue was caused because the super_block cleanup process
> was not properly performed.
> Therefore, deactivate_super() is called in extents_kunit_exit() to
> cleanup the super_block.
>
> Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  fs/ext4/extents-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> index 5a5016ea1ecc..70d84c0a18e2 100644
> --- a/fs/ext4/extents-test.c
> +++ b/fs/ext4/extents-test.c
> @@ -144,7 +144,7 @@ static void extents_kunit_exit(struct kunit *test)
>  {
>  	struct ext4_sb_info *sbi = k_ctx.k_ei->vfs_inode.i_sb->s_fs_info;
>  
> -	kfree(sbi);
> +	deactivate_super(sbi->s_sb);

This doesn't look correct. We don't have sbi->s_sb->s_op->put_super() registered, so
kfree(sbi) never happens. Maybe it will be good to check with kmemleak
too, that this could cause a memory leak.

I think we can do:

  ext4_es_unregister_shrinker(sbi); // already taken care in [1]
  deactivate_super(sbi->s_sb)
  kfree(sbi);

[1]: https://lore.kernel.org/linux-ext4/5bb9041471dab8ce870c191c19cbe4df57473be8.1772381213.git.ritesh.list@gmail.com/

-ritesh

  reply	other threads:[~2026-03-13 12:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 13:04 [PATCH -next 0/8] Fix some issues about ext4-test Ye Bin
2026-03-10 13:04 ` [PATCH -next 1/8] ext4: fix mballoc-test.c is not compiled when EXT4_KUNIT_TESTS=M Ye Bin
2026-03-11  2:44   ` kernel test robot
2026-03-11  3:26   ` kernel test robot
2026-03-10 13:04 ` [PATCH -next 2/8] ext4: introduce EXPORT_SYMBOL_FOR_EXT4_TEST() helper Ye Bin
2026-03-10 13:04 ` [PATCH -next 3/8] ext4: fix extents-test.c is not compiled when EXT4_KUNIT_TESTS=M Ye Bin
2026-03-11  6:32   ` kernel test robot
2026-03-10 13:04 ` [PATCH -next 4/8] ext4: fix miss unlock 'sb->s_umount' in extents_kunit_init() Ye Bin
2026-03-13 11:32   ` Ritesh Harjani
2026-03-10 13:04 ` [PATCH -next 5/8] ext4: fix miss free super_block in extents_kunit_exit() Ye Bin
2026-03-13 12:03   ` Ritesh Harjani [this message]
2026-03-13 14:03     ` Ojaswin Mujoo
2026-03-10 13:04 ` [PATCH -next 6/8] ext4: fix the error handling process in extents_kunit_init) Ye Bin
2026-03-13 12:15   ` Ritesh Harjani
2026-03-14  2:21     ` yebin (H)
2026-03-10 13:04 ` [PATCH -next 7/8] ext4: fix possible null-ptr-deref in extents_kunit_exit() Ye Bin
2026-03-13 12:27   ` Ritesh Harjani
2026-03-10 13:04 ` [PATCH -next 8/8] ext4: fix possible null-ptr-deref in mbt_kunit_exit() Ye Bin
2026-03-13 12:33   ` Ritesh Harjani
2026-03-13  7:16 ` [PATCH -next 0/8] Fix some issues about ext4-test Ojaswin Mujoo
2026-03-13 10:34   ` Ojaswin Mujoo

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=tsukszr0.ritesh.list@gmail.com \
    --to=ritesh.list@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yebin@huaweicloud.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 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.