aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorZixuan Fu <r33s3n6@gmail.com>2022-08-15 23:16:06 +0800
committerDavid Sterba <dsterba@suse.com>2022-08-22 18:06:33 +0200
commit9ea0106a7a3d8116860712e3f17cd52ce99f6707 (patch)
tree84332b7037a6dd5c9173260f35c7abcd2e69d5c3 /fs/btrfs/file.c
parentbtrfs: check if root is readonly while setting security xattr (diff)
downloadlinux-dev-9ea0106a7a3d8116860712e3f17cd52ce99f6707.tar.xz
linux-dev-9ea0106a7a3d8116860712e3f17cd52ce99f6707.zip
btrfs: fix possible memory leak in btrfs_get_dev_args_from_path()
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 leak. 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. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Fixes: faa775c41d655 ("btrfs: add a btrfs_get_dev_args_from_path helper") CC: stable@vger.kernel.org # 5.16 Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Zixuan Fu <r33s3n6@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/file.c')
0 files changed, 0 insertions, 0 deletions