diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-09-02 12:41:44 (GMT) |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-10-21 07:14:01 (GMT) |
commit | 8529a504273d4efa6bb004dcd6ef28fe67b64ae9 (patch) | |
tree | 3a6046100b725d8b263c4bd94baf6338dd4208b0 /drivers/char/virtio_console.c | |
parent | 3709ea7ae7d698b428576c2db0bbb6e08a18cf12 (diff) | |
download | linux-8529a504273d4efa6bb004dcd6ef28fe67b64ae9.tar.xz |
virtio: console: Unblock poll on port hot-unplug
When a port is hot-unplugged while an app is blocked on poll(), unblock
the poll() and return.
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 92f1f65..47b710c 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -663,6 +663,10 @@ static unsigned int port_fops_poll(struct file *filp, poll_table *wait) port = filp->private_data; poll_wait(filp, &port->waitqueue, wait); + if (!port->guest_connected) { + /* Port got unplugged */ + return POLLHUP; + } ret = 0; if (!will_read_block(port)) ret |= POLLIN | POLLRDNORM; |