summaryrefslogtreecommitdiff
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-04-08 09:46:16 -0600
committerRusty Russell <rusty@rustcorp.com.au>2010-04-08 09:46:17 +0930
commit9ff4cfab82d27e9fda72315f911bbaa9516e04bc (patch)
treea3c16833f8d9c0eb3d4194f4fd11c98e3899ffb4 /drivers/char/virtio_console.c
parent162a689a13ed61c0752726edb75427b2cd4186c1 (diff)
downloadlwn-9ff4cfab82d27e9fda72315f911bbaa9516e04bc.tar.gz
lwn-9ff4cfab82d27e9fda72315f911bbaa9516e04bc.zip
virtio: console makes incorrect assumption about virtio API
The get_buf() API sets the second arg to the number of bytes *written* by the other side; in this case it should be zero as these are output buffers. lguest gets this right (obviously kvm's console doesn't), resulting in continual buildup of console writes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 48306bc733f7..86e9011325dc 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -416,20 +416,16 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count)
out_vq->vq_ops->kick(out_vq);
if (ret < 0) {
- len = 0;
+ in_count = 0;
goto fail;
}
- /*
- * Wait till the host acknowledges it pushed out the data we
- * sent. Also ensure we return to userspace the number of
- * bytes that were successfully consumed by the host.
- */
+ /* Wait till the host acknowledges it pushed out the data we sent. */
while (!out_vq->vq_ops->get_buf(out_vq, &len))
cpu_relax();
fail:
/* We're expected to return the amount of data we wrote */
- return len;
+ return in_count;
}
/*