Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8529a504 authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell
Browse files

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: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 3709ea7a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;