]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
virtio: console makes incorrect assumption about virtio API
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 8 Apr 2010 15:46:16 +0000 (09:46 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 8 Apr 2010 00:16:17 +0000 (09:46 +0930)
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>
drivers/char/virtio_console.c

index 48306bc733f7d11f7d60c92dc633af95e236d60f..86e9011325dc5c044de36c979f34398994461bc3 100644 (file)
@@ -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;
 }
 
 /*