]> git.karo-electronics.de Git - linux-beck.git/commitdiff
virtio_blk: fix race at module removal
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 23 Oct 2014 15:57:19 +0000 (18:57 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 9 Dec 2014 10:05:27 +0000 (12:05 +0200)
If a device appears while module is being removed,
driver will get a callback after we've given up
on the major number.

In theory this means this major number can get reused
by something else, resulting in a conflict.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
drivers/block/virtio_blk.c

index 055f3df0b4d0192c4d890341451de70c1f4f5fc8..1f8b111c5dab788ce32e27f165d5330b0e3fb721 100644 (file)
@@ -884,8 +884,8 @@ out_destroy_workqueue:
 
 static void __exit fini(void)
 {
-       unregister_blkdev(major, "virtblk");
        unregister_virtio_driver(&virtio_blk);
+       unregister_blkdev(major, "virtblk");
        destroy_workqueue(virtblk_wq);
 }
 module_init(init);