diff options
author | Amit Shah | 2010-09-02 14:41:43 +0200 |
---|---|---|
committer | Rusty Russell | 2010-10-21 09:14:01 +0200 |
commit | 3709ea7ae7d698b428576c2db0bbb6e08a18cf12 (patch) | |
tree | b0c65cf625ac22023722280e0f113240e129007c /drivers/char/virtio_console.c | |
parent | virtio: console: Check if portdev is valid in send_control_msg() (diff) | |
download | kernel-qcow2-linux-3709ea7ae7d698b428576c2db0bbb6e08a18cf12.tar.gz kernel-qcow2-linux-3709ea7ae7d698b428576c2db0bbb6e08a18cf12.tar.xz kernel-qcow2-linux-3709ea7ae7d698b428576c2db0bbb6e08a18cf12.zip |
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 <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r-- | drivers/char/virtio_console.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e1d382b15532..92f1f65d57a9 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; } |