提交 0047634d 编写于 作者: A Amit Shah 提交者: Rusty Russell

virtio: console: Fix crash when hot-unplugging a port and read is blocked

When removing a port we don't check if a program was blocked for read.
This leads to a crash when SIGTERM is sent to the program after
hot-unplugging the port.
Signed-off-by: NAmit Shah <amit.shah@redhat.com>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 a5b365a6
......@@ -1099,6 +1099,13 @@ static int remove_port(struct port *port)
{
struct port_buffer *buf;
if (port->guest_connected) {
port->guest_connected = false;
port->host_connected = false;
wake_up_interruptible(&port->waitqueue);
send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
}
spin_lock_irq(&port->portdev->ports_lock);
list_del(&port->list);
spin_unlock_irq(&port->portdev->ports_lock);
......@@ -1120,9 +1127,6 @@ static int remove_port(struct port *port)
hvc_remove(port->cons.hvc);
#endif
}
if (port->guest_connected)
send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
device_destroy(pdrvdata.class, port->dev->devt);
cdev_del(&port->cdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册