diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-05-27 13:24:40 +0530 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-06-03 22:39:19 +0930 |
commit | 60e5e0b84045ce0f6ab07a02c7fcd6627b53d2d3 (patch) | |
tree | 10ce932b6087da2cb0d118b871b4044fbace7299 /drivers/char | |
parent | 0047634d3daebca9e99a22eb89167bf77f35cdfa (diff) | |
download | op-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.c | 4 |
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; |