bcache: fix use-after-free problem in bcache_device_free()
[linux-2.6-microblaze.git] / drivers / md / bcache / super.c
index 84a48ee..a7bb335 100644 (file)
@@ -885,9 +885,9 @@ static void bcache_device_free(struct bcache_device *d)
                bcache_device_detach(d);
 
        if (disk) {
-               blk_cleanup_disk(disk);
                ida_simple_remove(&bcache_device_idx,
                                  first_minor_to_idx(disk->first_minor));
+               blk_cleanup_disk(disk);
        }
 
        bioset_exit(&d->bio_split);