From patchwork Sat Jan 27 20:03:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 126053 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp1232612ljd; Sat, 27 Jan 2018 12:08:11 -0800 (PST) X-Google-Smtp-Source: AH8x224aVuglWDxf20DqBBfw5Jtqb6CI7WTsA5ym0ciWXw/sTBQg+4dmn/b+9AjiucjjG6p8yEZ9 X-Received: by 10.80.163.185 with SMTP id s54mr38764588edb.228.1517083691753; Sat, 27 Jan 2018 12:08:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517083691; cv=none; d=google.com; s=arc-20160816; b=hLOAxaZG2xM9yqTZZfQExeeqSYZdMBkiH23AMeB0IzdZUm4d2mvcIZov/Km+Ic8mpY 8ZpVdDymqxjpYqlsIk59iLrEbdRUwATh82rveELri1jNJkKh1SOSJuc2CMNOk8jvq5qf m4Z/CZSRsNqQolNgNU9niM3oUat7MLHsoI/70FitvZFwMKGlfXst5SFY3OXnrZMmfJkZ ks4JI2ILZUrxI2FHt+TLMbV0dKre26QQY0DbP/lMLIIuyxsywZjaOHZT5ZELJ9TfzP/p FXEwNFU3YpxEtBW5RwIz+3Mx5MpD85Aq3n6DXOFwIxLDTl/6LTGIFpEYuSxf0siZ6oBk qGpg== 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=wYMuCeQU0OAPVDQuajz1UDemYY7XHY/qX5r7Ro+hGfc=; b=L2YfmvD8DxCJcsvUi9pXNPh00cVzjnQHgCeV/W5VjvLjuv6Jl9aCULaR9aZasTEsG3 k0j8XgmWzU2pu0V+WG1aAsVlquS4mtpNkTDG2f6DSOYl9r1o9yRt5NOGPC8VLQXXau8i MV+rXQcExlDemYzcstKEmGp22q2n2uVLTDU/3v7MRthCRYsl26WKiTsCl/JFDzkyUrxJ LapYKi+V77W/vYgApkhcQVNllrIkRGy6ZcNLODs/mYSt1NOZZs+/Yf3kJa74OPSBvDJ2 vfJGWvyA5Z8Eci0oI49wHsFAUK0E/m6xNpX8X0Bws7Xe+tDUIsri0GndgiFXcqi6IBL8 xB4Q== 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 64si6089143ede.442.2018.01.27.12.08.11; Sat, 27 Jan 2018 12:08:11 -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 58030C21F49; Sat, 27 Jan 2018 20:08:08 +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=RCVD_IN_DNSWL_BLOCKED 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 7A5EDC21E28; Sat, 27 Jan 2018 20:08:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F1AB3C21E28; Sat, 27 Jan 2018 20:08:04 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id A30D3C21C8F for ; Sat, 27 Jan 2018 20:08:04 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D7E89AE8D; Sat, 27 Jan 2018 20:03:36 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Sat, 27 Jan 2018 21:03:36 +0100 Message-Id: <20180127200336.42896-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH v2 1/1] efi_loader: 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 --- v1 -> v2: - Fix subject line typo --- 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)); } /*