diff options
| -rw-r--r-- | drivers/block/virtio_blk.c | 4 | ||||
| -rw-r--r-- | drivers/char/virtio_console.c | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 83fa09a836ca..258bc2ae2885 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -298,7 +298,9 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
| 298 | err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, | 298 | err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, |
| 299 | offsetof(struct virtio_blk_config, seg_max), | 299 | offsetof(struct virtio_blk_config, seg_max), |
| 300 | &sg_elems); | 300 | &sg_elems); |
| 301 | if (err) | 301 | |
| 302 | /* We need at least one SG element, whatever they say. */ | ||
| 303 | if (err || !sg_elems) | ||
| 302 | sg_elems = 1; | 304 | sg_elems = 1; |
| 303 | 305 | ||
| 304 | /* We need an extra sg elements at head and tail. */ | 306 | /* We need an extra sg elements at head and tail. */ |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 8c99bf1b5e9f..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 | ||
| @@ -1099,6 +1103,13 @@ static int remove_port(struct port *port) | |||
| 1099 | { | 1103 | { |
| 1100 | struct port_buffer *buf; | 1104 | struct port_buffer *buf; |
| 1101 | 1105 | ||
| 1106 | if (port->guest_connected) { | ||
| 1107 | port->guest_connected = false; | ||
| 1108 | port->host_connected = false; | ||
| 1109 | wake_up_interruptible(&port->waitqueue); | ||
| 1110 | send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); | ||
| 1111 | } | ||
| 1112 | |||
| 1102 | spin_lock_irq(&port->portdev->ports_lock); | 1113 | spin_lock_irq(&port->portdev->ports_lock); |
| 1103 | list_del(&port->list); | 1114 | list_del(&port->list); |
| 1104 | spin_unlock_irq(&port->portdev->ports_lock); | 1115 | spin_unlock_irq(&port->portdev->ports_lock); |
| @@ -1120,9 +1131,6 @@ static int remove_port(struct port *port) | |||
| 1120 | hvc_remove(port->cons.hvc); | 1131 | hvc_remove(port->cons.hvc); |
| 1121 | #endif | 1132 | #endif |
| 1122 | } | 1133 | } |
| 1123 | if (port->guest_connected) | ||
| 1124 | send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); | ||
| 1125 | |||
| 1126 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | 1134 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); |
| 1127 | device_destroy(pdrvdata.class, port->dev->devt); | 1135 | device_destroy(pdrvdata.class, port->dev->devt); |
| 1128 | cdev_del(&port->cdev); | 1136 | cdev_del(&port->cdev); |
