From patchwork Tue Jun 12 08:21:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138300 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5056423lji; Tue, 12 Jun 2018 01:21:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIFbnPQENPwNfHRgY5xeSrL3kZVDZP3JR058bhNX6EvTyPn6xInoZLq4Gvj3CUBwX/tR0St X-Received: by 2002:a50:c2d9:: with SMTP id u25-v6mr2774004edf.56.1528791682964; Tue, 12 Jun 2018 01:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528791682; cv=none; d=google.com; s=arc-20160816; b=yAKUfv09opgk2FP4fT0FMBd3/eNEpA/45A4ya6gDldh6yts6J3AtNtUYBll5Cnszee ifPih5+Qs9qz4OhELq5E6I2uYyYOEh+oJ/jn0bZ3bdAgAqpUzRLdPXM/nvp5rdZNjBXo zc4m84DyeO4D5S1iUzqEqFCo4h7yGEvXsKgZY5T77bHvmWdFO079Sp8WUFkPuUa2kLgU myWgIjaVlNEHHOahl/2IOHghv+xL91KHfYVjhkVPGBQdrD7MexpHLA22CTU9YzpCn+DK 1F7z6joBJgVNCAnA2mDo8+C8loVfrWs7Y6CWJGFJ6FyR62bFUndBCSAZ10VbDe2mwMs4 EfOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=kj5U+AdjX65F7y7Tyc47f0M/kF+Lfh657+NBMrKm57U=; b=TSULkPOGh3qPbco+s/qll0pD3jYWMXlDbnx+AtOoKmJ1hTP/rZbnd+L52IwoCF8p4T cArA2hv1hDiJQQ4Y2luiSn0QGpDo5rQjpeTB+nX0XkIquherFu/iW5rOIIrVT06+rmAZ njI/AOhd8TeHrY5q0/6bwgdbWqJIBmiYeTdtOFbUeb7LMUx6a8FmaueebRueC63Yb4xV 3yGKa6SeGqiYsPqBifeEDFb59eE97bcD/63FyICOfGHgxwCKk0nPj8rFeKkJU4mwSaii KpmotBnRkkrQdjVRcVx8OHZxQbz0daPP2H3Db7FEQdOft1BYNhYAxny7YfdvduNpGWXh qEgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id d7-v6si595017ede.253.2018.06.12.01.21.22; Tue, 12 Jun 2018 01:21:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 7D189C21BE5; Tue, 12 Jun 2018 08:21:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B1D26C21CB6; Tue, 12 Jun 2018 08:21:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E5DEEC21CB6; Tue, 12 Jun 2018 08:21:16 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id A0A56C21BE5 for ; Tue, 12 Jun 2018 08:21:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5BB75AE39; Tue, 12 Jun 2018 08:21:16 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Tue, 12 Jun 2018 10:21:16 +0200 Message-Id: <20180612082116.85341-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH] efi_loader: Allocate memory handle for mem dp X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When we boot using memdp (bootefi on an address without previous load that populates the device path) then the memory device path we pass in is not backed by any handle. That can result in weird effects. For example grub gets very grumpy about this inside the efi_net module and just loops endlessly. So let's expose a simple handle that the memory device path is backed on. That way any code that looks for the device the dp is on, finds one. Signed-off-by: Alexander Graf --- cmd/bootefi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 707d159bac..f55a40dc84 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -263,6 +263,7 @@ static efi_status_t do_bootefi_exec(void *efi, { struct efi_loaded_image loaded_image_info = {}; struct efi_object loaded_image_info_obj = {}; + struct efi_object mem_obj = {}; struct efi_device_path *memdp = NULL; efi_status_t ret; @@ -279,6 +280,12 @@ static efi_status_t do_bootefi_exec(void *efi, /* actual addresses filled in after efi_load_pe() */ memdp = efi_dp_from_mem(0, 0, 0); device_path = image_path = memdp; + efi_add_handle(&mem_obj); + + ret = efi_add_protocol(mem_obj.handle, &efi_guid_device_path, + device_path); + if (ret != EFI_SUCCESS) + goto exit; } else { assert(device_path && image_path); } @@ -343,6 +350,8 @@ static efi_status_t do_bootefi_exec(void *efi, exit: /* image has returned, loaded-image obj goes *poof*: */ list_del(&loaded_image_info_obj.link); + if (mem_obj.handle) + list_del(&mem_obj.link); return ret; }