]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Fix a potential race in pciInitDevice.
authorChris Lalancette <clalance@redhat.com>
Wed, 28 Jul 2010 18:07:08 +0000 (14:07 -0400)
committerChris Lalancette <clalance@redhat.com>
Thu, 29 Jul 2010 14:18:23 +0000 (10:18 -0400)
commit56b408231a913f07d81e4a9c24f907efdae7dbf5
tree9dea898dd43ccc0f02df898ab882ebe5f343b459
parent82b6d7600e2c1ea23a18b23984d7d8d47961cfc9
Fix a potential race in pciInitDevice.

If detecting the FLR flag of a pci device fails, then we
could run into the situation of trying to close a file
descriptor twice, once in pciInitDevice() and once in pciFreeDevice().
Fix that by removing the pciCloseConfig() in pciInitDevice() and
just letting pciFreeDevice() handle it.

Thanks to Chris Wright for pointing out this problem.

While we are at it, fix an error check.  While it would actually
work as-is (since success returns 0), it's still more clear to
check for < 0 (as the rest of the code does).

Signed-off-by: Chris Lalancette <clalance@redhat.com>
src/qemu/qemu_driver.c
src/util/pci.c