From: Amit Shah Date: Thu, 2 Sep 2010 12:41:44 +0000 (+0530) Subject: virtio: console: Unblock poll on port hot-unplug X-Git-Tag: v2.6.37-rc1~219^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8529a504273d4efa6bb004dcd6ef28fe67b64ae9;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 Signed-off-by: Rusty Russell --- 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;