Skip to content

Commit

Permalink
virtio: console: Fix crash when port is unplugged and blocked for write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amit Shah authored and Rusty Russell committed Jun 3, 2010
1 parent 0047634 commit 60e5e0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 60e5e0b

Please sign in to comment.