Commit f90fc547 authored by Anand Jain's avatar Anand Jain Committed by David Sterba

Btrfs: Check if kobject is initialized before put

Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Tested-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
parent 24199d20
...@@ -523,9 +523,11 @@ static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs) ...@@ -523,9 +523,11 @@ static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
fs_devs->device_dir_kobj = NULL; fs_devs->device_dir_kobj = NULL;
} }
kobject_del(&fs_devs->super_kobj); if (fs_devs->super_kobj.state_initialized) {
kobject_put(&fs_devs->super_kobj); kobject_del(&fs_devs->super_kobj);
wait_for_completion(&fs_devs->kobj_unregister); kobject_put(&fs_devs->super_kobj);
wait_for_completion(&fs_devs->kobj_unregister);
}
} }
/* when fs_devs is NULL it will remove all fsid kobject */ /* when fs_devs is NULL it will remove all fsid kobject */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment