diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-09-05 14:21:23 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-09-08 15:05:20 +1000 |
commit | 3037e6c59656daf510e9ced820d149d74f8a499c (patch) | |
tree | 8496d7da464266eb5904bdb21e1f15823f3660b8 /discover/device-handler.h | |
parent | 4232af7eb3585cc5cc1413a8a2a6287a1643957e (diff) | |
download | talos-petitboot-3037e6c59656daf510e9ced820d149d74f8a499c.tar.gz talos-petitboot-3037e6c59656daf510e9ced820d149d74f8a499c.zip |
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 <sam@mendozajonas.com>
(cherry picked from commit 1def8f21aecc41ac22652e7b8bd1f5bf7a4dae98)
Diffstat (limited to 'discover/device-handler.h')
-rw-r--r-- | discover/device-handler.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/discover/device-handler.h b/discover/device-handler.h index a456181..79b34d6 100644 --- a/discover/device-handler.h +++ b/discover/device-handler.h @@ -80,7 +80,7 @@ const struct discover_device *device_handler_get_device( const struct device_handler *handler, unsigned int index); struct discover_device *discover_device_create(struct device_handler *handler, - const char *id); + const char *uuid, const char *id); void device_handler_add_device(struct device_handler *handler, struct discover_device *device); void device_handler_add_ramdisk(struct device_handler *handler, |