]> git.ozlabs.org Git - petitboot/commit
discover: Allow load_async_url() to call callback for local paths
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 9 Feb 2018 04:14:22 +0000 (15:14 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 27 Feb 2018 00:43:36 +0000 (11:43 +1100)
commitdc85de97c79c2172a87fc95cca16e6c6055dc1f4
tree77d66129e6d07fdae0894ad8e5b823736c57c103
parentaa23987dd043f7c8bea5a48bd9476a4ca1620069
discover: Allow load_async_url() to call callback for local paths

Several pxe-parser tests fail because the test harness's version of
load_async_url() will call the callback directly, but in pxe-parser the
caller checks if the path was local and calls the callback immediately.
Being called twice, a use-after-free occurs in the callback.

For consistency change the load_async_url() semantics such that it is
possible for load_async_url() to call the callback before it returns in
the case of local paths. Callers need to know this is possible, but now
won't need to check to call it manually.

This requires a slight reorganisation of the boot_process() code, since
it checks the result of several asynchronous load operations in the same
callback, and with this change not all of those results will necessarily
be initialised at callback time. Add a list of 'boot_resources' which
carry the required information for the resource and allow the boot
handler to treat different resources generically.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/boot.c
discover/boot.h
discover/paths.c
discover/pxe-parser.c