path: root/discover/udev.c
diff options
authorSamuel Mendoza-Jonas <>2016-09-05 14:21:23 +1000
committerSamuel Mendoza-Jonas <>2016-09-08 14:26:27 +1000
commit1def8f21aecc41ac22652e7b8bd1f5bf7a4dae98 (patch)
tree34ce7ff6feff3181c4312b80aad4af391ba94277 /discover/udev.c
parent4da0965a861bedd4332217c131abf399bc2b5a18 (diff)
discover: Pass UUID to discover_device_create()
Currently discover_device_create() will search for existing discover devices by id to determine if a new device is required. However it is possible under some circumstances for distinct devices to have the same name. This is especially troublesome if the following network events are seen in network_handle_nlmsg(): - New interface, 'foo' with uuid x:x:x:x:x:x -> new discover device created with dev->device->id = 'foo' dev->uuid = x:x:x:x:x:x - New interface, 'foo' with uuid y:y:y:y:y:y -> existing device 'foo' found dev->uuid = y:y:y:y:y:y This can occur if an interface rename event arrives *after* an old name is reused, where temporarily Petitboot will see two distinct network interfaces with the same name. Now the two interfaces point to the same discover device, which can quickly result in a segfault if a 'remove' event occurs for one of the interfaces and the discover device is freed. To generally avoid this a 'uuid' parameter is added to discover_device_create(), which if present allows existing devices to be looked up by UUID rather than just their name. Signed-off-by: Samuel Mendoza-Jonas <>
Diffstat (limited to 'discover/udev.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/discover/udev.c b/discover/udev.c
index f4cefab..1e04313 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -158,7 +158,7 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev,
- ddev = discover_device_create(udev->handler, name);
+ ddev = discover_device_create(udev->handler, uuid, name);
ddev->device_path = talloc_strdup(ddev, node);
OpenPOWER on IntegriCloud