mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
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: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
c1895442be
commit
8321cf2596
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue