aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2013-07-29 00:55:38 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-07-29 01:20:49 -0400
commit314081f1025e9ea77b69261f21183e9be18a6f91 (patch)
tree5e6dc6c56dc4017999f646f4916cb3f8cc0055e5 /drivers/char
parent5549fb25811710585d5ec77a0e6a1fbc8808df93 (diff)
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: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/virtio_console.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 3572c5a92e8e..d5e2c7050291 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1661,7 +1661,9 @@ static void handle_control_message(struct ports_device *portdev,
1661 * If the guest is connected, it'll be interested in 1661 * If the guest is connected, it'll be interested in
1662 * knowing the host connection state changed. 1662 * knowing the host connection state changed.
1663 */ 1663 */
1664 spin_lock_irq(&port->inbuf_lock);
1664 send_sigio_to_port(port); 1665 send_sigio_to_port(port);
1666 spin_unlock_irq(&port->inbuf_lock);
1665 break; 1667 break;
1666 case VIRTIO_CONSOLE_PORT_NAME: 1668 case VIRTIO_CONSOLE_PORT_NAME:
1667 /* 1669 /*
@@ -1781,13 +1783,13 @@ static void in_intr(struct virtqueue *vq)
1781 if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev)) 1783 if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev))
1782 discard_port_data(port); 1784 discard_port_data(port);
1783 1785
1786 /* Send a SIGIO indicating new data in case the process asked for it */
1787 send_sigio_to_port(port);
1788
1784 spin_unlock_irqrestore(&port->inbuf_lock, flags); 1789 spin_unlock_irqrestore(&port->inbuf_lock, flags);
1785 1790
1786 wake_up_interruptible(&port->waitqueue); 1791 wake_up_interruptible(&port->waitqueue);
1787 1792
1788 /* Send a SIGIO indicating new data in case the process asked for it */
1789 send_sigio_to_port(port);
1790
1791 if (is_console_port(port) && hvc_poll(port->cons.hvc)) 1793 if (is_console_port(port) && hvc_poll(port->cons.hvc))
1792 hvc_kick(); 1794 hvc_kick();
1793} 1795}