All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-rng: Remove false BUG for spurious callbacks
@ 2009-04-23  7:12 Rusty Russell
  2009-04-24 15:23   ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Rusty Russell @ 2009-04-23  7:12 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, virtualization, Christian Borntraeger, stable

From: Christian Borntraeger <borntraeger@de.ibm.com>

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 <borntraeger@de.ibm.com>
---
 drivers/char/hw_random/virtio-rng.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/char/hw_random/virtio-rng.c
===================================================================
--- linux-2.6.orig/drivers/char/hw_random/virtio-rng.c
+++ linux-2.6/drivers/char/hw_random/virtio-rng.c
@@ -37,9 +37,9 @@ static void random_recv_done(struct virt
 {
 	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);

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH] virtio-rng: Remove false BUG for spurious callbacks
@ 2009-04-23  7:12 Rusty Russell
  0 siblings, 0 replies; 6+ messages in thread
From: Rusty Russell @ 2009-04-23  7:12 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Christian Borntraeger, stable, linux-kernel, virtualization

From: Christian Borntraeger <borntraeger@de.ibm.com>

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 <borntraeger@de.ibm.com>
---
 drivers/char/hw_random/virtio-rng.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/char/hw_random/virtio-rng.c
===================================================================
--- linux-2.6.orig/drivers/char/hw_random/virtio-rng.c
+++ linux-2.6/drivers/char/hw_random/virtio-rng.c
@@ -37,9 +37,9 @@ static void random_recv_done(struct virt
 {
 	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);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-26 13:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23  7:12 [PATCH] virtio-rng: Remove false BUG for spurious callbacks Rusty Russell
2009-04-24 15:23 ` Linus Torvalds
2009-04-24 15:23   ` Linus Torvalds
2009-04-26 13:00   ` Rusty Russell
2009-04-26 13:00     ` Rusty Russell
2009-04-23  7:12 Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.