瀏覽代碼

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>
Amit Shah 14 年之前
父節點
當前提交
8529a50427
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      drivers/char/virtio_console.c

+ 4 - 0
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;