Skip to content

Commit 92d3453

Browse files
amit3srustyrussell
authored andcommitted
virtio: console: fix raising SIGIO after port unplug
SIGIO should be sent when a port gets unplugged. It should only be sent to prcesses that have the port opened, and have asked for SIGIO to be delivered. We were clearing out guest_connected before calling send_sigio_to_port(), resulting in a sigio not getting sent to processes. Fix by setting guest_connected to false after invoking the sigio function. CC: <stable@vger.kernel.org> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent ea3768b commit 92d3453

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/char/virtio_console.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,12 +1551,14 @@ static void unplug_port(struct port *port)
15511551
spin_unlock_irq(&port->portdev->ports_lock);
15521552

15531553
if (port->guest_connected) {
1554+
/* Let the app know the port is going down. */
1555+
send_sigio_to_port(port);
1556+
1557+
/* Do this after sigio is actually sent */
15541558
port->guest_connected = false;
15551559
port->host_connected = false;
1556-
wake_up_interruptible(&port->waitqueue);
15571560

1558-
/* Let the app know the port is going down. */
1559-
send_sigio_to_port(port);
1561+
wake_up_interruptible(&port->waitqueue);
15601562
}
15611563

15621564
if (is_console_port(port)) {

0 commit comments

Comments
 (0)