From 38f37b578f7d62a827d6f42e21d55bf428f9af8e Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Thu, 23 Oct 2014 18:57:19 +0300 Subject: [PATCH] virtio_blk: fix race at module removal 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 Reviewed-by: Cornelia Huck --- drivers/block/virtio_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 055f3df0b4d0..1f8b111c5dab 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -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); -- 2.34.1