Hide Forgot
Created attachment 477452 [details] Demo program to show the double-close() on config_fd Description of problem: Investigating a libvirt bug 675698, we uncovered a double close() that can occur on the config_fd variable, if pci_system_init/pci_system_cleanup are run twice (or more) in a row within one process In this sequence of operations: pci_system_init() pci_get_strings() pci_system_cleanup() nullfd = open('/dev/null', O_RDONLY) pci_system_init() pci_get_strings() pci_system_cleanup() close(nullfd); The final close() call will get an error, because the FD associated with nullfd was closed by the second pci_get_strings() call :-( The problem is simply that pci_device_linux_sysfs_destroy() fails to re-initialize the global 'config_fd' varaible to -1 after closing it. Version-Release number of selected component (if applicable): libpciaccess-0.10.9-2.el6 How reproducible: Always Steps to Reproduce: 1. Save attached demo program to pcidemo.c 2. gcc -Wall -o pcidemo pcidemo.c -lpciaccess 3. ./pcidemo Actual results: Error from final close() call, due to a double-close Expected results: No errors. Additional info:
Created attachment 477453 [details] Patch to fix double-close of config_fd
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. If you would like it considered as an exception in the current release, please ask your support representative.
MODIFIED built libpciaccess-0.10.9-4.el6 in brew.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0806.html