aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>2014-05-22 16:43:43 -0400
committerChris Mason <clm@fb.com>2014-06-09 20:21:01 -0400
commit8321cf2596d283821acc466377c2b85bcd3422b7 (patch)
tree26b0bb5da4b57aa099d2834b72740205e77b8fd8 /fs/btrfs/volumes.c
parentc1895442be01c58449e3bf9272f22062a670e08f (diff)
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>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c5
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)
1690 struct btrfs_fs_devices *fs_devices; 1690 struct btrfs_fs_devices *fs_devices;
1691 fs_devices = root->fs_info->fs_devices; 1691 fs_devices = root->fs_info->fs_devices;
1692 while (fs_devices) { 1692 while (fs_devices) {
1693 if (fs_devices->seed == cur_devices) 1693 if (fs_devices->seed == cur_devices) {
1694 fs_devices->seed = cur_devices->seed;
1694 break; 1695 break;
1696 }
1695 fs_devices = fs_devices->seed; 1697 fs_devices = fs_devices->seed;
1696 } 1698 }
1697 fs_devices->seed = cur_devices->seed;
1698 cur_devices->seed = NULL; 1699 cur_devices->seed = NULL;
1699 lock_chunks(root); 1700 lock_chunks(root);
1700 __btrfs_close_devices(cur_devices); 1701 __btrfs_close_devices(cur_devices);