Simple virtio-rng fix.
Thanks, Rusty. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJRP+naAAoJENkgDmzRrbjxur0P/3ZXZOlJgs+GbrZ1EpSgOfFV 3HECtYjkPerZ34wKn2Y6Q3Ip8rDG6+ZarQMxzOkzFdMr2fjiOXFkZX5aLBsy99sn w+dNiu0LYrDSKTPPytNS3jUtnYEQMC/piYH2wO7PB+p1mZvrL+FepcigxKA9KJ90 B8V0Fo9e8uY2/ownRLuD3umG7pSVM01QAqKv6oIvc7kMAp0eAkLq2haKdH1tGLsI uBDgH/Ah7k6rJhrpSRjckeocE2GcmNt5n58MeiABT5ZGmd9V9Qvl7rsbbzQYgrC6 J/BFS7cII9lkw2nGXVX2w8/AAzXARCP7FobPQ8L9dkpEt/R2aONgnPd8QicazbqH zhktrnSaYiR1gKVhIn3bP+NY8sJPnG6GBBY9L3JV0xQpTHqbv32J1UOnAqxp5wrC +i6CCKESDr4Okc7PWQXwNdyG6RBcpADnmnZDmJ9s91fjhOdXB2X7IGX+SjIbmq6L dQA2C5k06bKDKbuihI4XbcTAja/jNb9e+AB9spuyqrQhsrgOkRf6YQTozN1CScSn 4TOlVI2ddE5m2dSTDPxGx7C1FugxvT89jGAVPfgrfsuKC8aTAwawBQvNO9qBnFN0 l4LIN9v5pJBQPwOUGlJezRa2jSv4+lLmb9wGHMj2m++Ev0aYU7Y4KjMMbugK+7d9 W0oq16qSW8J23X9DngX0 =wJLR -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
a3633f6730
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue