diff options
author | Anand Jain <Anand.Jain@oracle.com> | 2015-06-22 18:18:32 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-06-22 14:43:31 +0200 |
commit | f90fc5472882ee7e76e0f345b9642b92c8677582 (patch) | |
tree | f88e1768ba9d68a266f12ac65929e7ad49bbf8d0 /fs/btrfs | |
parent | 24199d206a739a77edc3ff6c429b68b7bd6b2ef8 (diff) | |
download | linux-f90fc5472882ee7e76e0f345b9642b92c8677582.tar.gz linux-f90fc5472882ee7e76e0f345b9642b92c8677582.tar.bz2 linux-f90fc5472882ee7e76e0f345b9642b92c8677582.zip |
Btrfs: Check if kobject is initialized before put
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/sysfs.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index ea81a057c79b..603b0cc2b9bb 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -523,9 +523,11 @@ static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs) fs_devs->device_dir_kobj = NULL; } - kobject_del(&fs_devs->super_kobj); - kobject_put(&fs_devs->super_kobj); - wait_for_completion(&fs_devs->kobj_unregister); + if (fs_devs->super_kobj.state_initialized) { + kobject_del(&fs_devs->super_kobj); + kobject_put(&fs_devs->super_kobj); + wait_for_completion(&fs_devs->kobj_unregister); + } } /* when fs_devs is NULL it will remove all fsid kobject */ |