From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.7259.1582720879064063836 for ; Wed, 26 Feb 2020 04:41:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=rja6wIx0; spf=pass (domain: linaro.org, ip: 209.85.221.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f67.google.com with SMTP id z15so2860247wrl.1 for ; Wed, 26 Feb 2020 04:41:18 -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; bh=xoWh1/kW8XXw3SjZmcxklT7DQ6XHMmmtykVsUMir3TU=; b=rja6wIx0Es86adSIzA35ARM6wn0QbydqQfc59UYgnJSSBykXq4RwqV147RLeybiuVW HbcPeQOgTAHAu44HhJDaBfJKeS7pXhVSec/K4rtjeqNPkN9yuyR6jbjYc8Kd+HFaArGq p11dszsTZSlopGf0quU9qIf0cjCtILnxdLGZcqGSO0+s9cDuEJF/35fHntvXaA/T1PMF 7bL3fEeSqyTKOHhrdu81cR8y9EkY784Zf51pkmu/xKssCguMRTEdH3nhf8l24LfyxPHP DgCngSYBWllIPD/M7mM8brX08u2SRTpNoDybH0Ll4b3H3RZoddDi+NtGt1YXnUcT2OmG mehA== 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; bh=xoWh1/kW8XXw3SjZmcxklT7DQ6XHMmmtykVsUMir3TU=; b=nkdiiXb1/KFE+9XbT0nsWxE+rYxj6Wd7NAYvIDjmzFhDzb5PHMEG+dGH2O2j09j/MD sTZVaFiCYL/nOtnnTa7kQ4NSwTJXTZ4+UsFW9PaQV0mOlH4xzmeoIOPBAVVkck22/nof sUJu5/Mzwsf7NmKvAEFT/pb+8kJE/pSgc2UF17uWrBRQwfsezAqlhumwXztLgpevMwu8 ZK6gPhOMBgLIN4AqOzwUyTMIMf+yF62lCArLUNf8o71z6n5fNnCnjHIpuUo3qfsnEjjN FaHkzsWTDqkB8ng6q+T1tIqDMtN/TQc1mesJm7g/GnEHi1zu5vcVGnT0oRDK+rbI+0BJ 8jpg== X-Gm-Message-State: APjAAAWngSMpsz6BA3d7ubspX9Xl3b6DqODsqhtbuK05nEDmFcHHFqKX K97oMgbI4G/CrU08mf6FcT6jbCLBO5a0xA== X-Google-Smtp-Source: APXvYqz9etgmbPMWqAuvgmXjXIJl3WG6vsayeAKtYwWTkvJ7DV4wPHO6+PP707mROgeQR0sifKgCLQ== X-Received: by 2002:adf:e5c4:: with SMTP id a4mr5838430wrn.292.1582720877376; Wed, 26 Feb 2020 04:41:17 -0800 (PST) Return-Path: Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id h2sm3078981wrt.45.2020.02.26.04.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 04:41:16 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, liming.gao@intel.com, Ard Biesheuvel Subject: [PATCH 1/1] ArmPkg/MmCommunicationDxe: fix logic bug in DXE driver entrypoint Date: Wed, 26 Feb 2020 13:41:03 +0100 Message-Id: <20200226124103.17125-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Commit 2fe25a74d6fee3c2 ("ArmPkg/MmCommunicationDxe: relay architected PI events to MM context") update the ARM specific standalone MM client driver to register for certain events in the entrypoint code, but did so in a way that makes the entrypoint always return with an error. Instead, return EFI_SUCCESS if registering for those events succeeds, and back out the registrations that did succeed if one fails, and return an error. Fixes: 2fe25a74d6fee3c2 ("ArmPkg/MmCommunicationDxe: relay architected PI events to MM context") Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c index a4ee4dcd864c..6c06b3574861 100644 --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c @@ -385,8 +385,16 @@ MmCommunication2Initialize ( MmGuidedEventNotify, mGuidedEventGuid[Index], mGuidedEventGuid[Index], &mGuidedEvent[Index]); ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + while (Index-- > 0) { + gBS->CloseEvent (mGuidedEvent[Index]); + } + goto UninstallProtocol; + } } + return EFI_SUCCESS; +UninstallProtocol: gBS->UninstallProtocolInterface ( mMmCommunicateHandle, &gEfiMmCommunication2ProtocolGuid, -- 2.17.1