From: Christian Borntraeger Date: Fri, 24 Apr 2009 22:35:03 +0000 (+0000) Subject: virtio-rng: Remove false BUG for spurious callbacks X-Git-Tag: v2.6.29.3~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87b59eac0914ab407df57fe23d880dccd9a9436d;p=thirdparty%2Fkernel%2Fstable.git virtio-rng: Remove false BUG for spurious callbacks upstream commit: e5b89542ea18020961882228c26db3ba87f6e608 The virtio-rng drivers checks for spurious callbacks. Since callbacks can be implemented via shared interrupts (e.g. PCI) this could lead to guest kernel oopses with lots of virtio devices. Signed-off-by: Christian Borntraeger Cc: Rusty Russell Cc: stable@kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Chris Wright --- diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index d0e563e4fc399..86e83f883139e 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -37,9 +37,9 @@ static void random_recv_done(struct virtqueue *vq) { int len; - /* We never get spurious callbacks. */ + /* We can get spurious callbacks, e.g. shared IRQs + virtio_pci. */ if (!vq->vq_ops->get_buf(vq, &len)) - BUG(); + return; data_left = len / sizeof(random_data[0]); complete(&have_data);