]> git.ozlabs.org Git - petitboot/blobdiff - discover/device-handler.c
discover/device-handler: Ignore options without kernel
[petitboot] / discover / device-handler.c
index 9fd9fab5cf5f60db1b8c372b7401cc07b511b176..e230e7669ac31e3c4e04a35b35cf71be8155eb81 100644 (file)
@@ -861,7 +861,7 @@ out:
        device_handler_boot_status(handler, status);
 
        talloc_free(status);
-       talloc_free(ctx);
+       talloc_unlink(handler, ctx);
 
        return 0;
 }
@@ -900,7 +900,7 @@ int device_handler_dhcp(struct device_handler *handler,
        device_handler_boot_status(handler, status);
 
        talloc_free(status);
-       talloc_free(ctx);
+       talloc_unlink(handler, ctx);
 
        return 0;
 }
@@ -930,7 +930,7 @@ int device_handler_conf(struct device_handler *handler,
        device_handler_boot_status(handler, status);
 
        talloc_free(status);
-       talloc_free(ctx);
+       talloc_unlink(handler, ctx);
 
        return 0;
 }
@@ -1162,7 +1162,7 @@ void device_handler_process_url(struct device_handler *handler,
 
        device_handler_discover_context_commit(handler, ctx);
 
-       talloc_free(ctx);
+       talloc_unlink(handler, ctx);
 
        status->type = BOOT_STATUS_INFO;
        status->message = talloc_asprintf(status, _("Config file %s parsed"),
@@ -1191,6 +1191,14 @@ void device_handler_discover_context_commit(struct device_handler *handler,
        list_for_each_entry_safe(&ctx->boot_options, opt, tmp, list) {
                list_remove(&opt->list);
 
+               /* All boot options need at least a kernel image */
+               if (!opt->boot_image || !opt->boot_image->url) {
+                       pb_log("boot option %s is missing boot image, ignoring\n",
+                               opt->option->id);
+                       talloc_free(opt);
+                       continue;
+               }
+
                if (boot_option_resolve(opt, handler)) {
                        pb_log("boot option %s is resolved, "
                                        "sending to clients\n",