Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8321cf25 authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Chris Mason
Browse files

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: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent c1895442
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1690,11 +1690,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
		struct btrfs_fs_devices *fs_devices;
		fs_devices = root->fs_info->fs_devices;
		while (fs_devices) {
			if (fs_devices->seed == cur_devices)
			if (fs_devices->seed == cur_devices) {
				fs_devices->seed = cur_devices->seed;
				break;
			}
			fs_devices = fs_devices->seed;
		}
		fs_devices->seed = cur_devices->seed;
		cur_devices->seed = NULL;
		lock_chunks(root);
		__btrfs_close_devices(cur_devices);