mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
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>
This commit is contained in:
parent
84ec06c59a
commit
3709ea7ae7
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user