diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-11-10 00:04:29 +0100 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-11-11 07:39:57 +0100 |
commit | 46652a861b46cc62e9d983d5cf6d9532cd6fccab (patch) | |
tree | 94e9e81bf631f365cc87a3996e615c19b1dd3b83 | |
parent | virtio: Fix comment typo 'CONFIG_S_FAILED' (diff) | |
download | linux-46652a861b46cc62e9d983d5cf6d9532cd6fccab.tar.xz linux-46652a861b46cc62e9d983d5cf6d9532cd6fccab.zip |
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.
To fix, cleanup in reverse order of initialization.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | drivers/block/virtio_blk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index c6a27d54ad62..ce848ac1e9a6 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -871,8 +871,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); |