]> git.ozlabs.org Git - petitboot/commit
discover/event: Ensure event struct exists for async callers v1.2.4
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Thu, 1 Sep 2016 04:32:03 +0000 (14:32 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 2 Sep 2016 04:27:29 +0000 (14:27 +1000)
commitc8c61f78d0583acedcde0ba69b57936bf27337ca
treeea577a0745cf6373d98db5efdff65830eb632a24
parent5496eee36f70631ae45403f90ed7b4dc143f27c0
discover/event: Ensure event struct exists for async callers

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)
discover/device-handler.c
discover/user-event.c