Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-f…
Browse files Browse the repository at this point in the history
…or-linus

* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
  virtio: console: Enable call to hvc_remove() on console port remove
  virtio_pci: Prevent double-free of pci regions after device hot-unplug
  virtio: Decrement avail idx on buffer detach
  • Loading branch information
Linus Torvalds committed Apr 21, 2011
2 parents 8ed54bd + afa2689 commit 83425ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
11 changes: 0 additions & 11 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port)
spin_lock_irq(&pdrvdata_lock);
list_del(&port->cons.list);
spin_unlock_irq(&pdrvdata_lock);
#if 0
/*
* hvc_remove() not called as removing one hvc port
* results in other hvc ports getting frozen.
*
* Once this is resolved in hvc, this functionality
* will be enabled. Till that is done, the -EPIPE
* return from get_chars() above will help
* hvc_console.c to clean up on ports we remove here.
*/
hvc_remove(port->cons.hvc);
#endif
}

/* Remove unused data this port might have received. */
Expand Down
15 changes: 8 additions & 7 deletions drivers/virtio/virtio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,10 @@ static struct virtio_config_ops virtio_pci_config_ops = {

static void virtio_pci_release_dev(struct device *_d)
{
struct virtio_device *dev = container_of(_d, struct virtio_device, dev);
struct virtio_device *dev = container_of(_d, struct virtio_device,
dev);
struct virtio_pci_device *vp_dev = to_vp_device(dev);
struct pci_dev *pci_dev = vp_dev->pci_dev;

vp_del_vqs(dev);
pci_set_drvdata(pci_dev, NULL);
pci_iounmap(pci_dev, vp_dev->ioaddr);
pci_release_regions(pci_dev);
pci_disable_device(pci_dev);
kfree(vp_dev);
}

Expand Down Expand Up @@ -681,6 +676,12 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev)
struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);

unregister_virtio_device(&vp_dev->vdev);

vp_del_vqs(&vp_dev->vdev);
pci_set_drvdata(pci_dev, NULL);
pci_iounmap(pci_dev, vp_dev->ioaddr);
pci_release_regions(pci_dev);
pci_disable_device(pci_dev);
}

#ifdef CONFIG_PM
Expand Down
1 change: 1 addition & 0 deletions drivers/virtio/virtio_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq)
/* detach_buf clears data, so grab it now. */
buf = vq->data[i];
detach_buf(vq, i);
vq->vring.avail->idx--;
END_USE(vq);
return buf;
}
Expand Down

0 comments on commit 83425ee

Please sign in to comment.