Merge branch 'virtio' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* 'virtio' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: virtio: console: Fix crash when port is unplugged and blocked for write virtio: console: Fix crash when hot-unplugging a port and read is blocked virtio-blk: fix minimum number of S/G elements
This commit is contained in:
commit
636667a545
2 changed files with 14 additions and 4 deletions
|
@ -298,7 +298,9 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
|
||||||
err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX,
|
err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX,
|
||||||
offsetof(struct virtio_blk_config, seg_max),
|
offsetof(struct virtio_blk_config, seg_max),
|
||||||
&sg_elems);
|
&sg_elems);
|
||||||
if (err)
|
|
||||||
|
/* We need at least one SG element, whatever they say. */
|
||||||
|
if (err || !sg_elems)
|
||||||
sg_elems = 1;
|
sg_elems = 1;
|
||||||
|
|
||||||
/* We need an extra sg elements at head and tail. */
|
/* We need an extra sg elements at head and tail. */
|
||||||
|
|
|
@ -529,6 +529,10 @@ static bool will_write_block(struct port *port)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
|
if (!port->guest_connected) {
|
||||||
|
/* Port got hot-unplugged. Let's exit. */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!port->host_connected)
|
if (!port->host_connected)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1099,6 +1103,13 @@ static int remove_port(struct port *port)
|
||||||
{
|
{
|
||||||
struct port_buffer *buf;
|
struct port_buffer *buf;
|
||||||
|
|
||||||
|
if (port->guest_connected) {
|
||||||
|
port->guest_connected = false;
|
||||||
|
port->host_connected = false;
|
||||||
|
wake_up_interruptible(&port->waitqueue);
|
||||||
|
send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock_irq(&port->portdev->ports_lock);
|
spin_lock_irq(&port->portdev->ports_lock);
|
||||||
list_del(&port->list);
|
list_del(&port->list);
|
||||||
spin_unlock_irq(&port->portdev->ports_lock);
|
spin_unlock_irq(&port->portdev->ports_lock);
|
||||||
|
@ -1120,9 +1131,6 @@ static int remove_port(struct port *port)
|
||||||
hvc_remove(port->cons.hvc);
|
hvc_remove(port->cons.hvc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (port->guest_connected)
|
|
||||||
send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
|
|
||||||
|
|
||||||
sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
|
sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
|
||||||
device_destroy(pdrvdata.class, port->dev->devt);
|
device_destroy(pdrvdata.class, port->dev->devt);
|
||||||
cdev_del(&port->cdev);
|
cdev_del(&port->cdev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue