summaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-03-14 17:45:02 +0530
committerRusty Russell <rusty@rustcorp.com.au>2011-04-21 22:57:00 +0930
commit31a3ddda166cda86d2b5111e09ba4bda5239fae6 (patch)
tree9cd6af0a5a7b59b4452db2fa84545ce782c4006b /mm/rmap.c
parentb3258ff1d6086bd2b9eeb556844a868ad7d49bc8 (diff)
downloadlinux-31a3ddda166cda86d2b5111e09ba4bda5239fae6.tar.bz2
virtio_pci: Prevent double-free of pci regions after device hot-unplug
In the case where a virtio-console port is in use (opened by a program) and a virtio-console device is removed, the port is kept around but all the virtio-related state is assumed to be gone. When the port is finally released (close() called), we call device_destroy() on the port's device. This results in the parent device's structures to be freed as well. This includes the PCI regions for the virtio-console PCI device. Once this is done, however, virtio_pci_release_dev() kicks in, as the last ref to the virtio device is now gone, and attempts to do pci_iounmap(pci_dev, vp_dev->ioaddr); pci_release_regions(pci_dev); pci_disable_device(pci_dev); which results in a double-free warning. Move the code that releases regions, etc., to the virtio_pci_remove() function, and all that's now left in release_dev is the final freeing of the vp_dev. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'mm/rmap.c')
0 files changed, 0 insertions, 0 deletions