diff options
author | Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> | 2014-05-23 00:43:43 +0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-10 04:21:01 +0400 |
commit | 8321cf2596d283821acc466377c2b85bcd3422b7 (patch) | |
tree | 26b0bb5da4b57aa099d2834b72740205e77b8fd8 | |
parent | c1895442be01c58449e3bf9272f22062a670e08f (diff) | |
download | linux-8321cf2596d283821acc466377c2b85bcd3422b7.tar.xz |
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>
-rw-r--r-- | fs/btrfs/volumes.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 7d725a9ce670..ffeed6d6326f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -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); |