From: Amit Shah Date: Thu, 2 Sep 2010 12:41:43 +0000 (+0530) Subject: virtio: console: Un-block reads on chardev close X-Git-Tag: v2.6.37-rc1~219^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3709ea7ae7d698b428576c2db0bbb6e08a18cf12;p=platform%2Fkernel%2Flinux-3.10.git virtio: console: Un-block reads on chardev close If a chardev is closed, any blocked read / poll calls should just return and not attempt to use other state. Signed-off-by: Amit Shah Signed-off-by: Rusty Russell --- diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e1d382b..92f1f65 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -528,6 +528,10 @@ static ssize_t fill_readbuf(struct port *port, char *out_buf, size_t out_count, /* The condition that must be true for polling to end */ static bool will_read_block(struct port *port) { + if (!port->guest_connected) { + /* Port got hot-unplugged. Let's exit. */ + return false; + } return !port_has_data(port) && port->host_connected; }