diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-05-27 03:54:40 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-06-03 09:09:19 -0400 |
commit | 60e5e0b84045ce0f6ab07a02c7fcd6627b53d2d3 (patch) | |
tree | 10ce932b6087da2cb0d118b871b4044fbace7299 /drivers/char | |
parent | 0047634d3daebca9e99a22eb89167bf77f35cdfa (diff) |
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 e3fb5296cf25..942a9826bd23 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) | |||
529 | { | 529 | { |
530 | bool ret; | 530 | bool ret; |
531 | 531 | ||
532 | if (!port->guest_connected) { | ||
533 | /* Port got hot-unplugged. Let's exit. */ | ||
534 | return false; | ||
535 | } | ||
532 | if (!port->host_connected) | 536 | if (!port->host_connected) |
533 | return true; | 537 | return true; |
534 | 538 | ||