summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-05-27 13:24:40 +0530
committerRusty Russell <rusty@rustcorp.com.au>2010-06-03 22:39:19 +0930
commit60e5e0b84045ce0f6ab07a02c7fcd6627b53d2d3 (patch)
tree10ce932b6087da2cb0d118b871b4044fbace7299 /drivers/char
parent0047634d3daebca9e99a22eb89167bf77f35cdfa (diff)
downloadop-kernel-dev-60e5e0b84045ce0f6ab07a02c7fcd6627b53d2d3.zip
op-kernel-dev-60e5e0b84045ce0f6ab07a02c7fcd6627b53d2d3.tar.gz
virtio: console: Fix crash when port is unplugged and blocked for write
When a program that has a virtio port opened and blocked for a write operation, a port hot-unplug event will later led to a crash when SIGTERM was sent to the program. Fix that. 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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index e3fb529..942a982 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -529,6 +529,10 @@ static bool will_write_block(struct port *port)
{
bool ret;
+ if (!port->guest_connected) {
+ /* Port got hot-unplugged. Let's exit. */
+ return false;
+ }
if (!port->host_connected)
return true;
OpenPOWER on IntegriCloud