]> git.ipfire.org Git - thirdparty/u-boot.git/commit
fs: btrfs: Prevent error pointer dereference in list_subvolums()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 26 Jul 2023 06:59:04 +0000 (09:59 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 8 Aug 2023 21:05:43 +0000 (17:05 -0400)
commitc331efd08766aa610aa14c957856ef5b0fa915df
tree406d397a264ad31bee75b899e4ea2581a4f94574
parentd8ac619a172451f46efd421d280b639c224b3de6
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>
fs/btrfs/subvolume.c