virtio_console: Free buffers from out-queue upon close
authorsjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com>
Fri, 16 Nov 2012 00:50:19 +0000 (11:20 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 18 Dec 2012 04:50:41 +0000 (15:20 +1030)
Free pending output buffers from the virtio out-queue when
host has acknowledged port_close.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (rebased & cut down)
drivers/char/virtio_console.c

index eecb1f9e2e6b97b789f4270b5b44d0099e526cd6..db244b5b6c8ad23dce053503b6883735a1487cfa 100644 (file)
@@ -1439,6 +1439,10 @@ static void remove_port_data(struct port *port)
        /* Remove buffers we queued up for the Host to send us data in. */
        while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
                free_buf(buf);
+
+       /* Free pending buffers from the out-queue. */
+       while ((buf = virtqueue_detach_unused_buf(port->out_vq)))
+               free_buf(buf);
 }
 
 /*