Commit a3633f67 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull virtio rng buffix from Rusty Russell:
 "Simple virtio-rng fix."

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  virtio: rng: disallow multiple device registrations, fixes crashes
parents 7946844a e84e7a56
......@@ -92,14 +92,22 @@ static int probe_common(struct virtio_device *vdev)
{
int err;
if (vq) {
/* We only support one device for now */
return -EBUSY;
}
/* We expect a single virtqueue. */
vq = virtio_find_single_vq(vdev, random_recv_done, "input");
if (IS_ERR(vq))
return PTR_ERR(vq);
if (IS_ERR(vq)) {
err = PTR_ERR(vq);
vq = NULL;
return err;
}
err = hwrng_register(&virtio_hwrng);
if (err) {
vdev->config->del_vqs(vdev);
vq = NULL;
return err;
}
......@@ -112,6 +120,7 @@ static void remove_common(struct virtio_device *vdev)
busy = false;
hwrng_unregister(&virtio_hwrng);
vdev->config->del_vqs(vdev);
vq = NULL;
}
static int virtrng_probe(struct virtio_device *vdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment