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::442; helo=mail-pf1-x442.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 EF9B621959CB2 for ; Mon, 25 Feb 2019 01:11:05 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id j5so4220940pfa.2 for ; Mon, 25 Feb 2019 01:11:05 -0800 (PST) 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=fgq0DFAlGOLGBCogc/Fot8qJvP1L65zxy71+wmHk4p0=; b=MD+SdmRY+Kn55+ZMPMvJF5x7rNtaESXuYVf+P3ZnC8fj4VVvGOr8xpeBPOILrfu1Ax vLzDXHnK33v1OF3BQPGGT0sCsSeQofEIPG/yKEW4L153vbwyn4YKd6tHQiowKrpYzqs1 8U+RLGNs/PxF5Y2mvmdqTBRqIrNEryuHE63D8guWtzbtvRaI21ULfOOrYDUQONS1sw6X i/tTXEM1njK8QcLDjbqFeSL0Q2kkG42JBA+I1AhhplDyPOtIA+xbjeZC007rBmQbYeMp SYhIJbf5PMRiIkUOz6BQFsP/1EmDVdhJzd2EaFJ7AsJQwzVqYVQUupqpFfDlyPi84egn mtOw== 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=jjYciC8J4kFKXb6HOk33vqOxAQjPbxWbDOOfftK3DiydDa8IJWwpPwujIgbvA5NcBE b7bRltGsVqk1CZvn21NVB+Hse/qQkaguO3kSLF53w78tLSX37DzDbXnjglaJG0Ctyvo/ 94+muxhgN5QuM+87c1iNX3fGb9SzcnF7wwQHe6GBvgMM15lS702h1Jrm/r/uE4OYcnsb G0GD0yr/KBhZ9hz1v6pQ9pTqEDmZG4fJNQ1p9gbxTUMRsNN1706zrt7DHpK5LH3/CRAq kVi9VM9w4zLBw1hNNSb+mi3TPz+6OxkWf2ckj5Nv3DQOxDqPZmhMZu3EWSGnJDJiYqis f/hw== X-Gm-Message-State: AHQUAuZ6Yr1c9ZSTcqLr0hOdqdjjLyPJnE9LFokR1hyroyLfB3qgDcB4 ZuVQZ6QvxIkGXXptN71iTzgXnA== X-Google-Smtp-Source: AHgI3IbYM1chYUvWQJyNVj70d6G0s5EEEQPjhP0HzuDV7QDfcApqDBRtYs87G6zTZYjUBDegdD1V+w== 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 Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, liming.gao@intel.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, waip23@126.com, Ming Huang 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> Subject: [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: Mon, 25 Feb 2019 09:11:06 -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 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 ( -- 2.9.5