提交 8321cf25 编写于 作者: R Rickard Strandqvist 提交者: Chris Mason

fs: btrfs: volumes.c: Fix for possible null pointer dereference

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: NRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: NChris Mason <clm@fb.com>
上级 c1895442
...@@ -1690,11 +1690,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) ...@@ -1690,11 +1690,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
struct btrfs_fs_devices *fs_devices; struct btrfs_fs_devices *fs_devices;
fs_devices = root->fs_info->fs_devices; fs_devices = root->fs_info->fs_devices;
while (fs_devices) { while (fs_devices) {
if (fs_devices->seed == cur_devices) if (fs_devices->seed == cur_devices) {
fs_devices->seed = cur_devices->seed;
break; break;
}
fs_devices = fs_devices->seed; fs_devices = fs_devices->seed;
} }
fs_devices->seed = cur_devices->seed;
cur_devices->seed = NULL; cur_devices->seed = NULL;
lock_chunks(root); lock_chunks(root);
__btrfs_close_devices(cur_devices); __btrfs_close_devices(cur_devices);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册