From: Michael S. Tsirkin Date: Thu, 23 Oct 2014 15:57:19 +0000 (+0300) Subject: virtio_blk: fix race at module removal X-Git-Tag: v3.19-rc1~25^2~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38f37b578f7d62a827d6f42e21d55bf428f9af8e;p=platform%2Fkernel%2Flinux-exynos.git 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 --- diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 055f3df..1f8b111 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);