From patchwork Tue Mar 19 12:59:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 160573 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3848450jad; Tue, 19 Mar 2019 05:59:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWJD0vkdZLqODWmbs2xPEM4g9dfmdQ69IDTrQddn6BHpHpdy/uq+9hXOG/e2979l0bDDTv X-Received: by 2002:a62:445a:: with SMTP id r87mr1805616pfa.13.1553000366684; Tue, 19 Mar 2019 05:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553000366; cv=none; d=google.com; s=arc-20160816; b=JhT1wg6DyC4GfVJ2JgqkMxjsi63xQa0UmOXDls2Lt9JpzHJFH2X9I+oLJk7gXcPwpB kXKjOIN4ffk4/VcrTMMxEKpkWKCpGlVsDesFSLiqJMw8dwjyEtalQTdcCA6B/ct5eube KZ61/4GQbQDO7Mh31V6i79axVIkGZfFEripvjXaRVITEP3eDGLaz1pDPtOuf1U6STE8m TDosntmrtkEmLFIsnKFx5MS6ESUaJJuw5pqgHmDHLWHDbg8dGwJPmVg9Ah6OBcJs8OVM BakvXMp/c3cjioFvbsOanYDtH79ubwUkf5c2LB0mv7a5A/UbprYtsg2bpxfQHtHCHW/R MJ3w== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=903m4vw+8MsZoutESQDPaAaOjKKYAUSoGmGrmzSUmK8=; b=0OeIhE3KfUYTB1+JLqiV4a7WYXsCNkvZB5HZtTTroV8I25cSbyTMdJIoDZodVEGs6e hVAjRI2RgeAQ8K6f4w+wjuG4fsiFfdzoqGInuuOr2EZXlVsQ03+21O5xhCPhmRZ227AD 743SJFUPdaEjvWnXPonuEd5BOxpEOy2S/l3wN6JXtcaiSeSdJM82Thxw1PRWnsVGkl02 ZiLOGTeqVHdcwRWL0NAUakZFz7XRP24hWhECVNFmzv/oj+tm7/6e1J01+78MIY4R3XNg A/v/nJ8q6hFiJpjET+8QLe36tbImnFL7HXlFxdpF2ndS3deZqZTNMpyz47SX+yfquCQx ++sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kAdNcski; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id k3si12189268pfb.100.2019.03.19.05.59.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 05:59:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kAdNcski; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4E9FB211E00E6; Tue, 19 Mar 2019 05:59:26 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::431; helo=mail-pf1-x431.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 950ED211DC094 for ; Tue, 19 Mar 2019 05:59:24 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id 8so10229305pfr.4 for ; Tue, 19 Mar 2019 05:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lc85FRyRgkYtwYizn6cf9SDt8M7cYenUwRqtZhMBbqA=; b=kAdNcski+GdyLR8ynEVRLMJ40ge3qtB9gaMdMl7KVtalxCo1ZLkO+JGx6KsKYlCXKH QM9aS4SMmUbENJHRSWx/d3J2jZo7bVr1wv4TY2kjbqdWRJ6c40A835ALlO7MBlu54HT6 RSorVU5Iw58hJnDhJVDitKo9aVenc9GbkJvEz2nZqVqdomz58Emq1ckvCdvnTyAWMevj 62mg4swyg6/FQdBsowmQdx2DzGEhNZjU/eXDJPGOgv1/IAeTE2q4bMHh8RrMcXXsN1W1 IVxLj8oRmizNX4wkYMCAmwK6si2M1cDp2s1wp59I87tDoUoUZV5DoYfnUCXZQYYqGAf6 w6Ug== 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=lc85FRyRgkYtwYizn6cf9SDt8M7cYenUwRqtZhMBbqA=; b=R86k8i0nLScOspzT9/VUQTILX6wJmyO49UPeegKSvuO7xI51Oz+FZC38qUMMuBAgM7 CYglDdpjh8mp7Qn1YstlsOQW/1MpXq9b95NoIHiJlXDgXFaap4tgRw9uGU17U++wQMsL 0ZitzMapJqIr7jnTnqwgowTaDQFGQPyiFrdFIXWcsrQwIRwZites/zY2DdxogbajmXSD CO8Tk6bgWPtn4ZIhsfSO8//LOwKjd8hJnbt8pxdHNNdwPzVT9dprB7b+Gq0gdN0e10Co t2hRVoavSwQ9AmhIH4cah0dZMeS/A6UKtCdfCmsV5MgcOb59x2YGYcA1ZIEUaoGPKZ9m D7tw== X-Gm-Message-State: APjAAAWRIG1IumFRpx1wOG0Zlgyp1Qu/2YWJTKgxOVgy90Q/2+mE09nM ZnHdhYQUDvi++1IpdkmSlCOauA== X-Received: by 2002:a62:55c7:: with SMTP id j190mr1795354pfb.226.1553000364291; Tue, 19 Mar 2019 05:59:24 -0700 (PDT) Received: from localhost.localdomain ([203.160.91.226]) by smtp.gmail.com with ESMTPSA id g2sm32111215pfm.144.2019.03.19.05.59.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Mar 2019 05:59:23 -0700 (PDT) From: Ming Huang To: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, hao.a.wu@intel.com, michael.d.kinney@intel.com, liming.gao@intel.com Date: Tue, 19 Mar 2019 20:59:13 +0800 Message-Id: <20190319125913.19187-2-ming.huang@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190319125913.19187-1-ming.huang@linaro.org> References: <20190319125913.19187-1-ming.huang@linaro.org> Subject: [edk2] [Patch MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangming23@huawei.com, zhangjinsong2@huawei.com, wanghuiqiang@huawei.com, mengfanrong@huawei.com, huangdaode@hisilicon.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 after ASSERT_EFI_ERROR. The Bugzilla tracker for this: https://bugzilla.tianocore.org/show_bug.cgi?id=1631 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.9.5 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm Reviewed-by: Hao Wu diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 4ce83ce22d61..0535cd7335b4 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1069,6 +1069,9 @@ BmExpandMediaDevicePath ( // 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 (