mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
fs: btrfs: Prevent error pointer dereference in list_subvolums()
If btrfs_read_fs_root() fails with -ENOENT, then we go to the next entry. Fine. But if it fails for a different reason then we need to clean up and return an error code. In the current code it doesn't clean up but instead dereferences "root" and crashes. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Marek Behún <kabel@kernel.org> Reviewed-by: Qu Wenruo <wqu@suse.com>
This commit is contained in:
@@ -199,6 +199,7 @@ static int list_subvolums(struct btrfs_fs_info *fs_info)
|
|||||||
ret = PTR_ERR(root);
|
ret = PTR_ERR(root);
|
||||||
if (ret == -ENOENT)
|
if (ret == -ENOENT)
|
||||||
goto next;
|
goto next;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
ret = list_one_subvol(root, result);
|
ret = list_one_subvol(root, result);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Reference in New Issue
Block a user