The udev monitor is not an immutable resource, so better protect every
access to it.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/node_device/node_device_udev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index fe21ad7df..6c7f887ed 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1615,6 +1615,7 @@ udevHandleOneDevice(struct udev_device *device)
}
+/* the caller must be holding the driver lock prior to calling this function */
static bool
udevEventCheckMonitorFD(struct udev_monitor *udev_monitor,
int fd)
@@ -1653,6 +1654,7 @@ udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
struct udev_device *device = NULL;
struct udev_monitor *udev_monitor = NULL;
+ nodeDeviceLock();
udev_monitor = DRV_STATE_UDEV_MONITOR(driver);
if (!udevEventCheckMonitorFD(udev_monitor, fd)) {
@@ -1661,6 +1663,7 @@ udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
}
device = udev_monitor_receive_device(udev_monitor);
+ nodeDeviceUnlock();
if (!device) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
--
2.13.5