node_device_udev: Serialize access to pci_get_strings)_
node_device_udev: Serialize access to pci_get_strings)_

Since the functions provided by libpciaccess are not thread-safe,
when the udev-event and nodedev-init threads of libvirt call the
pci_get_strings function provided by libpaciaccess at the same
time the following can happen:

nodedev-init thread:
nodeStateInitializeEnumerate ->
  udevEnumerateDevices->
    udevProcessDeviceListEntry ->
      udevAddOneDevice ->
        udevGetDeviceDetails->
          udevProcessPCI ->
            udevTranslatePCIIds ->
              pci_get_strings -> (libpciaccess)
                find_device_name ->
                  populate_vendor ->
                    d = realloc( vend->devices, (vend->num_devices + 1), * sizeof( struct pci_device_leaf ) );
                    vend->num_devices++;

udev-event thread:
udevEventHandleThread ->
  udevHandleOneDevice ->
    udevAddOneDevice->
      udevGetDeviceDetails->
        udevProcessPCI ->
          udevTranslatePCIIds ->
            pci_get_strings -> (libpciaccess)
              find_device_name ->
                populate_vendor ->
                  d = realloc( vend->devices, (vend->num_devices + 1), * sizeof( struct pci_device_leaf ) );
                  vend->num_devices++;

Signed-off-by: WangJian <469ac3ff4502c9da133cdb0573375fa7cada866d@huawei.com>
Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>
Reviewed-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

zippy2/libvirt,libvirt/libvirt,nertpinx/libvirt,zippy2/libvirt,libvirt/libvirt,crobinso/libvirt,nertpinx/libvirt,nertpinx/libvirt,jfehlig/libvirt,olafhering/libvirt,olafhering/libvirt,libvirt/libvirt,libvirt/libvirt,olafhering/libvirt,nertpinx/libvirt,crobinso/libvirt,jfehlig/libvirt,zippy2/libvirt,crobinso/libvirt,crobinso/libvirt,olafhering/libvirt,jfehlig/libvirt,nertpinx/libvirt,zippy2/libvirt,jfehlig/libvirt