aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/volumes.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 6ca0d9cc46f9..6104676857f5 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -555,12 +555,14 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
555 * This is ok to do without rcu read locked because we hold the 555 * This is ok to do without rcu read locked because we hold the
556 * uuid mutex so nothing we touch in here is going to disappear. 556 * uuid mutex so nothing we touch in here is going to disappear.
557 */ 557 */
558 name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); 558 if (orig_dev->name) {
559 if (!name) { 559 name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS);
560 kfree(device); 560 if (!name) {
561 goto error; 561 kfree(device);
562 goto error;
563 }
564 rcu_assign_pointer(device->name, name);
562 } 565 }
563 rcu_assign_pointer(device->name, name);
564 566
565 list_add(&device->dev_list, &fs_devices->devices); 567 list_add(&device->dev_list, &fs_devices->devices);
566 device->fs_devices = fs_devices; 568 device->fs_devices = fs_devices;