summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2014-03-13 11:23:40 +1030
committerRusty Russell <rusty@rustcorp.com.au>2014-03-13 11:27:57 +1030
commit9914a766174d50eb2343f204fef3ee23dbe07c4c (patch)
treeb234adcb592f1fca7b82a761b701a16c129a0280
parent4951cc9083147015338f61a187e072daf02dfd4e (diff)
downloadlinux-9914a766174d50eb2343f204fef3ee23dbe07c4c.tar.bz2
virtio-rng: don't crash if virtqueue is broken.
A bad implementation of virtio might cause us to mark the virtqueue broken: we'll dev_err() in that case, and the device is useless, but let's not BUG(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--drivers/char/hw_random/virtio-rng.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index c12398d1517c..2ce0e225e58c 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -47,8 +47,7 @@ static void register_buffer(u8 *buf, size_t size)
sg_init_one(&sg, buf, size);
/* There should always be room for one buffer. */
- if (virtqueue_add_inbuf(vq, &sg, 1, buf, GFP_KERNEL) < 0)
- BUG();
+ virtqueue_add_inbuf(vq, &sg, 1, buf, GFP_KERNEL);
virtqueue_kick(vq);
}