diff options
| author | Dan Carpenter <[email protected]> | 2023-07-26 09:59:04 +0300 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-08-08 17:05:43 -0400 |
| commit | c331efd08766aa610aa14c957856ef5b0fa915df (patch) | |
| tree | 406d397a264ad31bee75b899e4ea2581a4f94574 /fs/btrfs | |
| parent | d8ac619a172451f46efd421d280b639c224b3de6 (diff) | |
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 <[email protected]>
Reviewed-by: Marek BehĂșn <[email protected]>
Reviewed-by: Qu Wenruo <[email protected]>
Diffstat (limited to 'fs/btrfs')
| -rw-r--r-- | fs/btrfs/subvolume.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/subvolume.c b/fs/btrfs/subvolume.c index d446e7a2c41..68ca7e48e48 100644 --- a/fs/btrfs/subvolume.c +++ b/fs/btrfs/subvolume.c @@ -199,6 +199,7 @@ static int list_subvolums(struct btrfs_fs_info *fs_info) ret = PTR_ERR(root); if (ret == -ENOENT) goto next; + goto out; } ret = list_one_subvol(root, result); if (ret < 0) |
