diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-21 12:58:42 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-21 12:58:42 -0400 |
| commit | 83425eee85c6235392e3fe865faf533a48b60ab3 (patch) | |
| tree | e97a28eb4c8c8440c3beef6a6ee0c3dc2c6a2938 | |
| parent | 8ed54bd5657b75e654c5913bcc5c680485a531b6 (diff) | |
| parent | afa2689e19073cd2e762d0f2c1358fab1ab9f18c (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-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
| -rw-r--r-- | drivers/char/virtio_console.c | 11 | ||||
| -rw-r--r-- | drivers/virtio/virtio_pci.c | 15 | ||||
| -rw-r--r-- | drivers/virtio/virtio_ring.c | 1 |
3 files changed, 9 insertions, 18 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 84b164d1eb2b..838568a7dbf5 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port) | |||
| 1280 | spin_lock_irq(&pdrvdata_lock); | 1280 | spin_lock_irq(&pdrvdata_lock); |
| 1281 | list_del(&port->cons.list); | 1281 | list_del(&port->cons.list); |
| 1282 | spin_unlock_irq(&pdrvdata_lock); | 1282 | spin_unlock_irq(&pdrvdata_lock); |
| 1283 | #if 0 | ||
| 1284 | /* | ||
| 1285 | * hvc_remove() not called as removing one hvc port | ||
| 1286 | * results in other hvc ports getting frozen. | ||
| 1287 | * | ||
| 1288 | * Once this is resolved in hvc, this functionality | ||
| 1289 | * will be enabled. Till that is done, the -EPIPE | ||
| 1290 | * return from get_chars() above will help | ||
| 1291 | * hvc_console.c to clean up on ports we remove here. | ||
| 1292 | */ | ||
| 1293 | hvc_remove(port->cons.hvc); | 1283 | hvc_remove(port->cons.hvc); |
| 1294 | #endif | ||
| 1295 | } | 1284 | } |
| 1296 | 1285 | ||
| 1297 | /* Remove unused data this port might have received. */ | 1286 | /* Remove unused data this port might have received. */ |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 4fb5b2bf2348..4bcc8b82640b 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
| @@ -590,15 +590,10 @@ static struct virtio_config_ops virtio_pci_config_ops = { | |||
| 590 | 590 | ||
| 591 | static void virtio_pci_release_dev(struct device *_d) | 591 | static void virtio_pci_release_dev(struct device *_d) |
| 592 | { | 592 | { |
| 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, dev); | 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, |
| 594 | dev); | ||
| 594 | struct virtio_pci_device *vp_dev = to_vp_device(dev); | 595 | struct virtio_pci_device *vp_dev = to_vp_device(dev); |
| 595 | struct pci_dev *pci_dev = vp_dev->pci_dev; | ||
| 596 | 596 | ||
| 597 | vp_del_vqs(dev); | ||
| 598 | pci_set_drvdata(pci_dev, NULL); | ||
| 599 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
| 600 | pci_release_regions(pci_dev); | ||
| 601 | pci_disable_device(pci_dev); | ||
| 602 | kfree(vp_dev); | 597 | kfree(vp_dev); |
| 603 | } | 598 | } |
| 604 | 599 | ||
| @@ -681,6 +676,12 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | |||
| 681 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); | 676 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); |
| 682 | 677 | ||
| 683 | unregister_virtio_device(&vp_dev->vdev); | 678 | unregister_virtio_device(&vp_dev->vdev); |
| 679 | |||
| 680 | vp_del_vqs(&vp_dev->vdev); | ||
| 681 | pci_set_drvdata(pci_dev, NULL); | ||
| 682 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
| 683 | pci_release_regions(pci_dev); | ||
| 684 | pci_disable_device(pci_dev); | ||
| 684 | } | 685 | } |
| 685 | 686 | ||
| 686 | #ifdef CONFIG_PM | 687 | #ifdef CONFIG_PM |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cc2f73e03475..b0043fb26a4d 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq) | |||
| 371 | /* detach_buf clears data, so grab it now. */ | 371 | /* detach_buf clears data, so grab it now. */ |
| 372 | buf = vq->data[i]; | 372 | buf = vq->data[i]; |
| 373 | detach_buf(vq, i); | 373 | detach_buf(vq, i); |
| 374 | vq->vring.avail->idx--; | ||
| 374 | END_USE(vq); | 375 | END_USE(vq); |
| 375 | return buf; | 376 | return buf; |
| 376 | } | 377 | } |
