提交 314081f1 编写于 作者: A Amit Shah 提交者: Rusty Russell

virtio: console: fix locking around send_sigio_to_port()

send_sigio_to_port() checks the value of guest_connected, which we
always modify under the inbuf_lock; make sure invocations of
send_sigio_to_port() have take the inbuf_lock around the call.
Signed-off-by: NAmit Shah <amit.shah@redhat.com>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 5549fb25
...@@ -1661,7 +1661,9 @@ static void handle_control_message(struct ports_device *portdev, ...@@ -1661,7 +1661,9 @@ static void handle_control_message(struct ports_device *portdev,
* If the guest is connected, it'll be interested in * If the guest is connected, it'll be interested in
* knowing the host connection state changed. * knowing the host connection state changed.
*/ */
spin_lock_irq(&port->inbuf_lock);
send_sigio_to_port(port); send_sigio_to_port(port);
spin_unlock_irq(&port->inbuf_lock);
break; break;
case VIRTIO_CONSOLE_PORT_NAME: case VIRTIO_CONSOLE_PORT_NAME:
/* /*
...@@ -1781,13 +1783,13 @@ static void in_intr(struct virtqueue *vq) ...@@ -1781,13 +1783,13 @@ static void in_intr(struct virtqueue *vq)
if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev)) if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev))
discard_port_data(port); discard_port_data(port);
/* Send a SIGIO indicating new data in case the process asked for it */
send_sigio_to_port(port);
spin_unlock_irqrestore(&port->inbuf_lock, flags); spin_unlock_irqrestore(&port->inbuf_lock, flags);
wake_up_interruptible(&port->waitqueue); wake_up_interruptible(&port->waitqueue);
/* Send a SIGIO indicating new data in case the process asked for it */
send_sigio_to_port(port);
if (is_console_port(port) && hvc_poll(port->cons.hvc)) if (is_console_port(port) && hvc_poll(port->cons.hvc))
hvc_kick(); hvc_kick();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册