aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/exported-sql-viewer.py
diff options
context:
space:
mode:
authorDexuan Cui <[email protected]>2019-03-04 21:34:48 +0000
committerLorenzo Pieralisi <[email protected]>2019-03-26 19:12:08 +0000
commit05f151a73ec2b23ffbff706e5203e729a995cdc2 (patch)
tree976e035f4941d82296a5a01dff3ad1c1a6584f31 /tools/perf/scripts/python/exported-sql-viewer.py
parentbe20bbcb0a8cb5597cc62b3e28d275919f3431df (diff)
PCI: hv: Fix a memory leak in hv_eject_device_work()
When a device is created in new_pcichild_device(), hpdev->refs is set to 2 (i.e. the initial value of 1 plus the get_pcichild()). When we hot remove the device from the host, in a Linux VM we first call hv_pci_eject_device(), which increases hpdev->refs by get_pcichild() and then schedules a work of hv_eject_device_work(), so hpdev->refs becomes 3 (let's ignore the paired get/put_pcichild() in other places). But in hv_eject_device_work(), currently we only call put_pcichild() twice, meaning the 'hpdev' struct can't be freed in put_pcichild(). Add one put_pcichild() to fix the memory leak. The device can also be removed when we run "rmmod pci-hyperv". On this path (hv_pci_remove() -> hv_pci_bus_exit() -> hv_pci_devices_present()), hpdev->refs is 2, and we do correctly call put_pcichild() twice in pci_devices_present_work(). Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs") Signed-off-by: Dexuan Cui <[email protected]> [[email protected]: commit log rework] Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Stephen Hemminger <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Cc: [email protected]
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions