diff options
author | Naohiro Aota | 2018-07-27 09:04:55 +0900 |
---|---|---|
committer | David Sterba | 2018-08-06 13:13:04 +0200 |
commit | 39379faaad79e3cf403a6904a08676b7850043ae (patch) | |
tree | 6b7f07df694ff8e502a024f71a2dd0020f23e5c3 /.cocciconfig | |
parent | 64f64f43c89aca1782aa672e0586f6903c5d8979 (diff) |
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 '.cocciconfig')
0 files changed, 0 insertions, 0 deletions