All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: David Disseldorp <ddiss@suse.de>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix btrfs_test_delayed_refs leak
Date: Tue, 11 Feb 2025 13:24:21 +1030	[thread overview]
Message-ID: <61aedc2d-9629-47b0-bb78-29af0cf64162@suse.com> (raw)
In-Reply-To: <20250210111728.32320-2-ddiss@suse.de>



在 2025/2/10 21:47, David Disseldorp 写道:
> The btrfs_transaction struct leaks, which can cause sporadic xfstests
> failures when kmemleak checking is enabled:
> 
> kmemleak: 5 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
>> cat /sys/kernel/debug/kmemleak
> unreferenced object 0xffff88810fdc6c00 (size 512):
>    comm "modprobe", pid 203, jiffies 4294892552
>    hex dump (first 32 bytes):
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>    backtrace (crc 6736050f):
>      __kmalloc_cache_noprof+0x133/0x2c0
>      btrfs_test_delayed_refs+0x6f/0xbb0 [btrfs]
>      btrfs_run_sanity_tests.cold+0x91/0xf9 [btrfs]
>      0xffffffffa02fd055
>      do_one_initcall+0x49/0x1c0
>      do_init_module+0x5b/0x1f0
>      init_module_from_file+0x70/0x90
>      idempotent_init_module+0xe8/0x2c0
>      __x64_sys_finit_module+0x6b/0xd0
>      do_syscall_64+0x54/0x110
>      entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> The transaction struct was initially stack-allocated but switched to
> heap following frame size compiler warnings.
> 
> Fixes: 2b34879d97e27 ("btrfs: selftests: add delayed ref self test cases")
> Link: https://lore.kernel.org/all/20241206195100.GM31418@twin.jikos.cz/
> Signed-off-by: David Disseldorp <ddiss@suse.de>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/tests/delayed-refs-tests.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/tests/delayed-refs-tests.c b/fs/btrfs/tests/delayed-refs-tests.c
> index 6558508c2ddf5..265370e79a546 100644
> --- a/fs/btrfs/tests/delayed-refs-tests.c
> +++ b/fs/btrfs/tests/delayed-refs-tests.c
> @@ -1009,6 +1009,7 @@ int btrfs_test_delayed_refs(u32 sectorsize, u32 nodesize)
>   	if (!ret)
>   		ret = select_delayed_refs_test(&trans);
>   
> +	kfree(transaction);
>   out_free_fs_info:
>   	btrfs_free_dummy_fs_info(fs_info);
>   	return ret;


      parent reply	other threads:[~2025-02-11  2:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 11:17 [PATCH] btrfs: fix btrfs_test_delayed_refs leak David Disseldorp
2025-02-10 17:13 ` David Sterba
2025-02-11  2:54 ` Qu Wenruo [this message]

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=61aedc2d-9629-47b0-bb78-29af0cf64162@suse.com \
    --to=wqu@suse.com \
    --cc=ddiss@suse.de \
    --cc=linux-btrfs@vger.kernel.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.