From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Wentao Liang <vulab@iscas.ac.cn>, clm@fb.com
Cc: dsterba@suse.com, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org, list.btrfs@jan-o-sch.net,
stable@vger.kernel.org
Subject: Re: [PATCH] btrfs: Fix local_root reference leak in scrub_print_warning_inode()
Date: Thu, 17 Sep 2026 07:14:51 +0930 [thread overview]
Message-ID: <448ab459-a442-48ac-8834-46ca0b7e5e62@gmx.com> (raw)
In-Reply-To: <20260916171610.2086918-1-vulab@iscas.ac.cn>
在 2026/9/17 02:46, Wentao Liang 写道:
> When paths_from_inode() fails, scrub_print_warning_inode() jumps to
> err without dropping the reference taken by btrfs_get_fs_root(),
> leaking a reference to the root every time path resolution fails while
> printing scrub warnings. Every other error and success path of the
> function drops the reference.
>
> Drop the reference on the paths_from_inode() failure path too.
>
> Fixes: 558540c17771 ("btrfs scrub: print paths of corrupted files")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/scrub.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 1ac609239cbe..570828ec780b 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -549,8 +549,10 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 num_bytes,
> }
> ret = paths_from_inode(inum, ipath);
>
> - if (ret < 0)
> + if (ret < 0) {
> + btrfs_put_root(local_root);
> goto err;
> + }
>
> /*
> * we deliberately ignore the bit ipath might have been too small to
next prev parent reply other threads:[~2026-09-16 21:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 17:16 [PATCH] btrfs: Fix local_root reference leak in scrub_print_warning_inode() Wentao Liang
2026-09-16 21:44 ` Qu Wenruo [this message]
2026-09-21 12:28 ` David Sterba
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=448ab459-a442-48ac-8834-46ca0b7e5e62@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=list.btrfs@jan-o-sch.net \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/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