From: David Sterba <dsterba@suse.cz>
To: Zixuan Fu <r33s3n6@gmail.com>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com, TOTE Robot <oslab@tsinghua.edu.cn>
Subject: Re: [PATCH] fs: btrfs: fix possible memory leaks in btrfs_get_dev_args_from_path()
Date: Wed, 17 Aug 2022 16:42:56 +0200 [thread overview]
Message-ID: <20220817144256.GE13489@twin.jikos.cz> (raw)
In-Reply-To: <20220815151606.3479183-1-r33s3n6@gmail.com>
On Mon, Aug 15, 2022 at 11:16:06PM +0800, Zixuan Fu wrote:
> In btrfs_get_dev_args_from_path(), btrfs_get_bdev_and_sb() can fail if the
> path is invalid. In this case, btrfs_get_dev_args_from_path() returns
> directly without freeing args->uuid and args->fsid allocated before, which
> causes memory leaks.
>
> To fix these possible leaks, when btrfs_get_bdev_and_sb() fails,
> btrfs_put_dev_args_from_path() is called to clean up the memory.
>
> Fixes: faa775c41d655 ("btrfs: add a btrfs_get_dev_args_from_path helper")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Zixuan Fu <r33s3n6@gmail.com>
Added to misc-next, thanks.
prev parent reply other threads:[~2022-08-17 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 15:16 [PATCH] fs: btrfs: fix possible memory leaks in btrfs_get_dev_args_from_path() Zixuan Fu
2022-08-15 21:13 ` Boris Burkov
2022-08-17 14:42 ` David Sterba [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=20220817144256.GE13489@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=baijiaju1990@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oslab@tsinghua.edu.cn \
--cc=r33s3n6@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