From patchwork Mon Feb 25 09:10:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 159157 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp1802413jad; Mon, 25 Feb 2019 01:11:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjUb7mRuiBwJX8Vi6J28k3Jv5X3EY17spNq4A9M2AJ9zbQwPtM7i/NbUDV3BuOrLRegJzK X-Received: by 2002:ac8:28fc:: with SMTP id j57mr13225246qtj.103.1551085886424; Mon, 25 Feb 2019 01:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551085886; cv=none; d=google.com; s=arc-20160816; b=vd1xlmWqtPg8MMDmMWQQkFLK3drHYQBo7D0CRGiLDr/MmfJdhEy/QkgIlni3zl3RyY in8DszeIM5hyLPHtTrcUaN/OP+KNIepoM9L7UelikU1qzpBf2Thz9M8689yNdLrXzNhf 8a6DD6oyMeINZ0TZFuZL21tfo6PXRR5Mc0Ueb2l9RZO2clULJfgGEOP57gTk40ttSobK v/L1xLKTg+tFI/AlRZhz0SC70j7lyQTLAsqUjzuoE1IjXCP3HspDvRPv8U6Es8vrdJea 2XGTONx+r6wZSeQAqWblj4J7UjJVl4ym7h5E8ZSxP/ofFFKaTkG2DpI0KIkgayw92brW IHvQ== 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:references:in-reply-to:message-id :date:to:from:delivered-to; bh=7CMaKnUsBf46s5RbmtIBVLpEtUOwYXG4A+3y9QJuLqs=; b=pQ8MEzCbrFrL+aqzcCPs+u8Z31oQA2+KMCg+VQI09SuqusipmWtM5/WbURs/cR94Mb MjqKRRk1wBNjLM5C5U5QgkWpd8WgPebjjDctdyvrf9Ql0llhqVoyLB0QpzgV9sPapvKy jyeFz9tiMX+sE9OOLB5bg+biElv535s59FPfArbX3fQbfmS8WK7NDL9e8kp4JDBr29oe 1iXtUjsgKP4BeHA/DvVnJ1LeWAgz7pHJEv7qrMSlwKyKL5zF4SCSdL2ddierMPcN3gIa JU4Tc9RUCjLdzOSzdRYe+/FO+sIUco8MtFX8OXuvGe5GIbVx3H73g8MacyAZohOZ8XGk YH2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.158.76.221 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org Return-Path: Received: from lists.linaro.org (ec2-54-158-76-221.compute-1.amazonaws.com. [54.158.76.221]) by mx.google.com with ESMTPS id t80si574728qka.200.2019.02.25.01.11.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 01:11:26 -0800 (PST) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.158.76.221 as permitted sender) client-ip=54.158.76.221; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.158.76.221 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org Received: from lists.linaro.org (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9078760790; Mon, 25 Feb 2019 09:11:25 +0000 (UTC) Received: by lists.linaro.org (Postfix, from userid 109) id 7EA5C609AB; Mon, 25 Feb 2019 09:11:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ip-10-150-125-211.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.2 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3A80F60790; Mon, 25 Feb 2019 09:11:14 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: from lists.linaro.org (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id CEEC660786 for ; Mon, 25 Feb 2019 09:11:07 +0000 (UTC) Received: by lists.linaro.org (Postfix, from userid 109) id C341560BF5; Mon, 25 Feb 2019 09:11:07 +0000 (UTC) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by lists.linaro.org (Postfix) with ESMTPS id 8173D60786 for ; Mon, 25 Feb 2019 09:11:06 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id n125so4215841pfn.5 for ; Mon, 25 Feb 2019 01:11:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fgq0DFAlGOLGBCogc/Fot8qJvP1L65zxy71+wmHk4p0=; b=DZDeiE7cCaBGQOQFAfv/pu/ZiQBQEyAkYLlm2stgVXCdQih5cUvlbAhsvIjUia3yS/ x3CXasZ2hXbMLhNir93trW6kETlURyAI1qSaoDcVJ1fd7qibKUp5BjLoF5PLC8T/a6GG +ipJ+SxqJIC5ZOwJ5gn/4S1F9ac4kktxXcfRIdjtcbT1R0lxw44qvAWj4QTkYUnIgtCA 3hTsh0nIUFDpZMAZ33bn+lUGSm2VQA4P5htbrqoIJZozZgDeBz/zSSJ0Jjql+WBCSlrc ATDmv/eyRL8DTUSdYxHyT9IQ2WRb/z1jixIL1nzukrp91ZrDb2ipO8roONTgU0hYERZg d2Hw== X-Gm-Message-State: AHQUAuYt+7yn4iRjySBcyvlZxUGM+8X3Qe55zv5ly4uVBSlf7zhrXalF MxP6AOFT0x9yYG0KXtWshDyOK9dpFJpx7w== X-Received: by 2002:a63:d347:: with SMTP id u7mr6545644pgi.269.1551085865548; Mon, 25 Feb 2019 01:11:05 -0800 (PST) Received: from localhost.localdomain ([203.160.91.226]) by smtp.gmail.com with ESMTPSA id z67sm15488716pfi.152.2019.02.25.01.11.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Feb 2019 01:11:04 -0800 (PST) From: Ming Huang To: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, star.zeng@intel.com, eric.dong@intel.com, ruiyu.ni@intel.com, dann.frazier@canonical.com Date: Mon, 25 Feb 2019 17:10:52 +0800 Message-Id: <20190225091052.25461-2-ming.huang@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190225091052.25461-1-ming.huang@linaro.org> References: <20190225091052.25461-1-ming.huang@linaro.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: huangming23@huawei.com, zhangjinsong2@huawei.com, liming.gao@intel.com, michael.d.kinney@intel.com, waip23@126.com, wanghuiqiang@huawei.com, huangdaode@hisilicon.com Subject: [Linaro-uefi] [MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "For discussions about Linaro-related UEFI development. Not a substitute for edk2-devel." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" X-Virus-Scanned: ClamAV using ClamSMTP The system environment: virtual-CDROM(USB interface) via BMC, insert a iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM to first boot option. With release version bios, disconnecting CDROM when boot to "1 seconds left, Press Esc or F2 to enter Setup" then system will get a exception. The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be uninstalled in this situation after print some transfer error. The status will be invalid parameter. This line will get a exception for BlockIo not point to right address: AllocatePool (BlockIo->Media->BlockSize) So, here need to judge the status not using ASSERT_EFI_ERROR. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index d5957db610d9..c2f1c651b02f 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1068,7 +1068,9 @@ BmExpandMediaDevicePath ( // Block IO read/write will success. // Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo); - ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return NULL; + } Buffer = AllocatePool (BlockIo->Media->BlockSize); if (Buffer != NULL) { BlockIo->ReadBlocks (