From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: APXvYqwIW/5SdS52Y57Vg6tG0e2LQlzCqxSAGgnhJl4J2+zjI12J6pKqWD1MTIcTmqnzqDD66IBdeg== 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 Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, mengfanrong@huawei.com, huangdaode@hisilicon.com, Ming Huang 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: [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: , X-List-Received-Date: Tue, 19 Mar 2019 12:59:24 -0000 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(+) 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 ( -- 2.9.5