Skip to content

Commit 8321cf2

Browse files
Rickard Strandqvistmasoncl
authored andcommitted
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 <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent c189544 commit 8321cf2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/btrfs/volumes.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,11 +1690,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
16901690
struct btrfs_fs_devices *fs_devices;
16911691
fs_devices = root->fs_info->fs_devices;
16921692
while (fs_devices) {
1693-
if (fs_devices->seed == cur_devices)
1693+
if (fs_devices->seed == cur_devices) {
1694+
fs_devices->seed = cur_devices->seed;
16941695
break;
1696+
}
16951697
fs_devices = fs_devices->seed;
16961698
}
1697-
fs_devices->seed = cur_devices->seed;
16981699
cur_devices->seed = NULL;
16991700
lock_chunks(root);
17001701
__btrfs_close_devices(cur_devices);

0 commit comments

Comments
 (0)