aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/volumes.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b8708f994e67..3b394503bd4e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -569,9 +569,11 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
569 memcpy(new_device, device, sizeof(*new_device)); 569 memcpy(new_device, device, sizeof(*new_device));
570 570
571 /* Safe because we are under uuid_mutex */ 571 /* Safe because we are under uuid_mutex */
572 name = rcu_string_strdup(device->name->str, GFP_NOFS); 572 if (device->name) {
573 BUG_ON(device->name && !name); /* -ENOMEM */ 573 name = rcu_string_strdup(device->name->str, GFP_NOFS);
574 rcu_assign_pointer(new_device->name, name); 574 BUG_ON(device->name && !name); /* -ENOMEM */
575 rcu_assign_pointer(new_device->name, name);
576 }
575 new_device->bdev = NULL; 577 new_device->bdev = NULL;
576 new_device->writeable = 0; 578 new_device->writeable = 0;
577 new_device->in_fs_metadata = 0; 579 new_device->in_fs_metadata = 0;