summaryrefslogtreecommitdiffstats
path: root/discover/device-handler.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-09-01 14:32:03 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-09-02 14:27:29 +1000
commitc8c61f78d0583acedcde0ba69b57936bf27337ca (patch)
treeea577a0745cf6373d98db5efdff65830eb632a24 /discover/device-handler.c
parent5496eee36f70631ae45403f90ed7b4dc143f27c0 (diff)
downloadtalos-petitboot-c8c61f78d0583acedcde0ba69b57936bf27337ca.tar.gz
talos-petitboot-c8c61f78d0583acedcde0ba69b57936bf27337ca.zip
discover/event: Ensure event struct exists for async callersv1.2.4
When handling an event, user_event_handle_message() creates an event struct with relevant parameters. Once user_event_handle_message() is finished it frees the struct. However in the case of a dhcp or add_url event, asynchronous jobs may be spawned that will later reference the event struct. In particular this becomes a problem when pxe_process_pair() handles an IPAPPEND name/value pair and tries to access event->device. In the case of dhcp and add_url events, we avoid this by changing the event struct's talloc parent to the discover_context struct which persists until all async pxe jobs have completed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> (cherry picked from commit a50d5fe279db71cf85fabeb675c99b167ec63dcb)
Diffstat (limited to 'discover/device-handler.c')
-rw-r--r--discover/device-handler.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index c31fcea..364b412 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -894,6 +894,7 @@ int device_handler_dhcp(struct device_handler *handler,
/* create our context */
ctx = device_handler_discover_context_create(handler, dev);
+ talloc_steal(ctx, event);
ctx->event = event;
iterate_parsers(ctx);
@@ -1165,6 +1166,7 @@ void device_handler_process_url(struct device_handler *handler,
if (pb_url->scheme == pb_url_file)
dev->device->type = DEVICE_TYPE_ANY;
ctx = device_handler_discover_context_create(handler, dev);
+ talloc_steal(ctx, event);
ctx->event = event;
iterate_parsers(ctx);
OpenPOWER on IntegriCloud