From patchwork Thu Jan 25 23:53:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 125874 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1477104ljf; Thu, 25 Jan 2018 15:54:05 -0800 (PST) X-Google-Smtp-Source: AH8x226dlXjoCNQtaPFwt80dJ+jlMRNS2FjLGCE0IOAeJsbd0Kn9fweHPsV0Ep3AAH1T2Mo5RrxX X-Received: by 10.80.141.70 with SMTP id t6mr26338511edt.238.1516924445057; Thu, 25 Jan 2018 15:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516924445; cv=none; d=google.com; s=arc-20160816; b=bNgWJTzTwU4CJHnKKXTfCYHicjW6ZFHhHx4psemv1LeQRNl+jq6DBqjv43ugBTZZRp xQAFX5qVk6S3MJjv+z1JQAiOsLM3ockUOGkuaj0EsLZ8Hp8LzwqEzQaz79azKyE6bkao 9TfifvmvS0TDpekVIwJJIanLlfM/qZxEEwzcvexTCoDaVJzRJgkyE6fHrrOsK0cCr6xm IT4pDh7BjEGuUWSf1mSvqwenVQDi6V2MUTMRlcB20yEUT6rGqJ/IlRCJWvPGimmqZkv4 FcTqkRlDIl4j/Glpimwt66atRmsSj/wlauGHWjOk/bz427NSCoDDDgsAZ5GH94fsQe3E JhBg== 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=l2B183ylDqj3luNNZPly4qFFoXtQddn5Hm6yEB+t93o=; b=D13UOpjsRjVBtMPE3z/8bcmcaqjLnmnRMLfA+av9xpjE/JK9hyECzCfSVo4g6WL9eX d44pPMz+e9E0qJGRn5FwoTe67i8odqVddVndvQMhRAXdqSulg/OACXn+isP2dFOYoMLf sHHrRFCC7T5wwmc+5tIHR0NlB62AXGd5iR4YmxW4r+urv0UckvHaZWZenBB5Xp+teMJd 2g5rxTE2JBYh/y7s2nl+4fNXxOvUpDsNnMUwJabqoUiIE4n1tJLuVHm/ZMH9c9nPm7On 8ISGZprtmzMa+Lvfp1T2789N4Nx78md/swmMwXQwbI0UmzTkik0uyA2+5x/BzwSasvsZ akhA== 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 c31si2929461edd.323.2018.01.25.15.54.04; Thu, 25 Jan 2018 15:54:05 -0800 (PST) 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 51C72C22382; Thu, 25 Jan 2018 23:54:03 +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 45DC9C21F16; Thu, 25 Jan 2018 23:54:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 28AD7C21F16; Thu, 25 Jan 2018 23:54:00 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id C4932C21D9F for ; Thu, 25 Jan 2018 23:53:59 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 12C13AE8C; Thu, 25 Jan 2018 23:53:59 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Fri, 26 Jan 2018 00:53:57 +0100 Message-Id: <20180125235357.36264-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH] efi_laoder: Call Exit() on return from payload in StartImage() 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 a UEFI payload just returns instead of calling the Exit() callback, we handle that in efi_do_enter() and call Exit on its behalf, so that the loaded_image->exit_status value is correct. We were missing that logic in StartImage(). Call it there too. Reported-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- lib/efi_loader/efi_boottime.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index f5dae40f06..4a36b62828 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1578,8 +1578,13 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle, ret = EFI_CALL(entry(image_handle, &systab)); - /* Should usually never get here */ - return EFI_EXIT(ret); + /* + * Usually UEFI applications call Exit() instead of returning. + * But because the world doesn not consist of ponies and unicorns, + * we're happy to emulate that behavior on behalf of a payload + * that forgot. + */ + return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL)); } /*