From patchwork Thu Nov 29 01:55:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 1004979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4350wv63scz9s7T for ; Thu, 29 Nov 2018 12:55:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="W6LV7Isc"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="AagBzjv6"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4350wv1DV8zDr0q for ; Thu, 29 Nov 2018 12:55:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="W6LV7Isc"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="AagBzjv6"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.28; helo=out4-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="W6LV7Isc"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="AagBzjv6"; dkim-atps=neutral Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4350wk0JjHzDqyk for ; Thu, 29 Nov 2018 12:55:49 +1100 (AEDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 3F28B21E5F; Wed, 28 Nov 2018 20:55:47 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Nov 2018 20:55:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=fm1; bh=QBeEFT4QvCTae NLAZgmGrfaRkFLow3zx2gbc83w71vg=; b=W6LV7IscQDxfH5yS/asAlmTEzQehg I6gn5EmRjoTnoJY0eLlk3ukTIHHneIHyj76liVXKBZd28S49Z6Au8vEmxyDauS9k du+80WHXmNG82/jqtMQERD38sCEvERlij6e4xlxGKg61jvm1zKypa+THgncdFwAn 8V2SgQlkl77ebvN9V1dYmun6WM5MTBmRBeC49igVMoU+E+wR/07Q2uJTHfGOQ6gv SdxrAZBWfpZ6gHclSw5mY6tZ/55YVIWjRZIsbISIH67RrDbN88j/obIKMt3Qcaem wA6qMcofhVy4jKU6mCICWtk4iJ+YjCRc8bqCRSZiR+1C7cw3ZDt6J7L9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=QBeEFT4QvCTaeNLAZ gmGrfaRkFLow3zx2gbc83w71vg=; b=AagBzjv6AJkkiteFel6m1Zg+Hn63RpcGY KPuqPfr1macgNKaltz/jJ/NJfGY1S/qrtsyjB694CPBoL8Lm/or/Ft364cXQldIJ xutw2ORI/1i6jwkCHcrnkVcckZYqZA5zxQZc+xmXLrbSV6X0TM5/tHonIqQI9Hkp JFf3ZHbNttQjhhnXCLsShiXBzqVqE1J2W3BKvFHtDXW/4abNAbM2KtnHy34sTjql yPd7v/VAPL0NZeVWRpuwg3mpiE9bKGFum5UlcyfL3NP2AeZPDowcT23rJKLE0hfz obv53+xTzgj6kjOihwAqI31BExU94pq4KZ1/kR/8FTYWXgI/R4s0A== X-ME-Sender: X-ME-Proxy: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 62FB8E405B; Wed, 28 Nov 2018 20:55:45 -0500 (EST) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH] discover/boot: Fix talloc parent for resource URLs Date: Thu, 29 Nov 2018 12:55:22 +1100 Message-Id: <20181129015522.15358-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" The pb_urls for the boot resources use 'opt' as the talloc parent but this may be NULL, for example if this is a user-created boot option. Move the boot_task initialisation so it can be used as the talloc parent instead. Signed-off-by: Samuel Mendoza-Jonas --- Alternate title: oh hey what's this branch from 2014? discover/boot.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/discover/boot.c b/discover/boot.c index ed67cd50..91fc46d6 100644 --- a/discover/boot.c +++ b/discover/boot.c @@ -526,25 +526,31 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt, update_status(status_fn, status_arg, STATUS_INFO, _("Booting %s"), boot_desc); + boot_task = talloc_zero(ctx, struct boot_task); + boot_task->dry_run = dry_run; + boot_task->status_fn = status_fn; + boot_task->status_arg = status_arg; + if (cmd && cmd->boot_image_file) { - image = pb_url_parse(opt, cmd->boot_image_file); + image = pb_url_parse(boot_task, cmd->boot_image_file); } else if (opt && opt->boot_image) { image = opt->boot_image->url; } else { pb_log_fn("no image specified\n"); update_status(status_fn, status_arg, STATUS_ERROR, _("Boot failed: no image specified")); + talloc_free(boot_task); return NULL; } if (cmd && cmd->initrd_file) { - initrd = pb_url_parse(opt, cmd->initrd_file); + initrd = pb_url_parse(boot_task, cmd->initrd_file); } else if (opt && opt->initrd) { initrd = opt->initrd->url; } if (cmd && cmd->dtb_file) { - dtb = pb_url_parse(opt, cmd->dtb_file); + dtb = pb_url_parse(boot_task, cmd->dtb_file); } else if (opt && opt->dtb) { dtb = opt->dtb->url; } @@ -554,10 +560,6 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt, setenv("https_proxy", opt->proxy, 1); } - boot_task = talloc_zero(ctx, struct boot_task); - boot_task->dry_run = dry_run; - boot_task->status_fn = status_fn; - boot_task->status_arg = status_arg; list_init(&boot_task->resources); lockdown_type = lockdown_status();