Skip to contentSkip to conversation

virtio-rng: Remove false BUG for spurious callbacks

PATCH In review Rusty Russell 2 participants 3 messages Apr 23, 2009 – Apr 26, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-rng: Remove false BUG for spurious callbacks

From: Christian Borntraeger <[email protected]>

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.

---
 drivers/char/hw_random/virtio-rng.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/hw_random/virtio-rng.c +2 -2
Index: 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);
#1 lore raw
Quoted 9 lines · Rusty Russell

From: Christian Borntraeger <[email protected]>

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.

---

I really would have liked a sign-off from you too, rusty. I'll take it as-is, since it's trivial, but just a note..

Linus

#2 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 7 lines · Rusty Russell

From: Christian Borntraeger <[email protected]>

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.

Quoted 5 lines
Quoted 2 lines

---

I really would have liked a sign-off from you too, rusty. I'll take it as-is, since it's trivial, but just a note..

Sorry, missed that one.

Thanks for the reminder,
Rusty.