From d94bb8c48f42678a5f1cf0041429b82aa1938540 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Mon, 23 Jan 2017 14:53:32 +1100 Subject: process: Cancel all asynchronous jobs on reinit If an asynchronous job is running over a reinit, the process can return and run its callback function after the reinit. This becomes a problem if the callback function accesses pointers that were only valid before the reinit (eg. device structs). If a reinit is requested explicitly stop all active asynchronous jobs and clear their callback functions before the reinit. Signed-off-by: Samuel Mendoza-Jonas --- discover/device-handler.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'discover/device-handler.c') diff --git a/discover/device-handler.c b/discover/device-handler.c index 78fb159..3cf7edf 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -358,6 +358,9 @@ void device_handler_reinit(struct device_handler *handler) handler->pending_boot_is_default = false; } + /* Cancel any remaining async jobs */ + process_stop_async_all(); + /* free unresolved boot options */ list_for_each_entry_safe(&handler->unresolved_boot_options, opt, tmp, list) -- cgit v1.2.1