qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read
@ 2013-04-16 10:28 Amit Shah
  2013-04-16 13:51 ` Andreas Färber
  2013-04-22 18:36 ` Anthony Liguori
  0 siblings, 2 replies; 4+ messages in thread
From: Amit Shah @ 2013-04-16 10:28 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Amit Shah, qemu list

Not handling EAGAIN triggers the assert

qemu/backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)
Aborted (core dumped)

This happens when starting a guest with '-device virtio-rng-pci',
issuing a 'cat /dev/hwrng' in the guest, while also doing 'cat
/dev/random' on the host.

Reported-by: yunpingzheng <yunzheng@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 backends/rng-random.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/backends/rng-random.c b/backends/rng-random.c
index d5761f2..830360c 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -41,6 +41,9 @@ static void entropy_available(void *opaque)
     ssize_t len;
 
     len = read(s->fd, buffer, s->size);
+    if (len < 0 && errno == EAGAIN) {
+        return;
+    }
     g_assert(len != -1);
 
     s->receive_func(s->opaque, buffer, len);
-- 
1.8.1.4

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

end of thread, other threads:[~2013-04-22 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 10:28 [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read Amit Shah
2013-04-16 13:51 ` Andreas Färber
2013-04-16 15:08   ` Amit Shah
2013-04-22 18:36 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).