summaryrefslogtreecommitdiff
path: root/fs/xfs
diff options
context:
space:
mode:
authorNaohiro Aota <naota@elisp.net>2018-07-27 03:04:55 +0300
committerDavid Sterba <dsterba@suse.com>2018-08-06 14:13:04 +0300
commit39379faaad79e3cf403a6904a08676b7850043ae (patch)
tree6b7f07df694ff8e502a024f71a2dd0020f23e5c3 /fs/xfs
parent64f64f43c89aca1782aa672e0586f6903c5d8979 (diff)
downloadlinux-39379faaad79e3cf403a6904a08676b7850043ae.tar.xz
btrfs: revert fs_devices state on error of btrfs_init_new_device
When btrfs hits error after modifying fs_devices in btrfs_init_new_device() (such as btrfs_add_dev_item() returns error), it leaves everything as is, but frees allocated btrfs_device. As a result, fs_devices->devices and fs_devices->alloc_list contain already freed btrfs_device, leading to later use-after-free bug. Error path also messes the things like ->num_devices. While they go back to the original value by unscanning btrfs devices, it is safe to revert them here. Fixes: 79787eaab461 ("btrfs: replace many BUG_ONs with proper error handling") Signed-off-by: Naohiro Aota <naota@elisp.net> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/xfs')
0 files changed, 0 insertions, 0 deletions