From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (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 4144C803EE for ; Tue, 21 Mar 2017 00:07:38 -0700 (PDT) Received: by mail-io0-x22a.google.com with SMTP id f84so43503776ioj.0 for ; Tue, 21 Mar 2017 00:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=SgCbOWxN5TdbHyMCfbXu3/BsANxczuqpyrlMchXu2aQ=; b=LxD2jaQYpcBf6O3OSLCPJmwtB5Id5HJJqAfcDhfIQHZvRljJc02ks5aqsN8Pb7NF4n 6UitROIz+mV8gv2rIxwbLkeh8OLyelHqFRRvsRRlwUD8LgSgnYVFTMoYelOpAn+KaKjo 8XYsh/Fo+k3oEdgCNGkmodm+Pc5ADfcvZiFpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=SgCbOWxN5TdbHyMCfbXu3/BsANxczuqpyrlMchXu2aQ=; b=uFYQkbRgA/u0zKquevq9DVSbUWeaqZ+/zycWKAzflKguXRBWH6PAcWsPSM07368tOk tuxlCXz3E1oAbkJ6hwsyc9TltTfuUc4id7gyHaQP0kOHEomTy0uDPVTUp2dmOK1c8CBl hIMr2KhdG4szJpby1ykbKwGod2cVgqCfAzzD/QmQf0oEvE3VMpPeMdOPi1tP/yX///Nw NqaUSIH9al6BhNOcpyuF184syaL8PxLc/eiQp+mrOsppx07sshgua436mR4aqesWrAYd 8vWenEgTuy1qIE1v4ptVMzPewQbTFZUVFIqpO8h4crbMxYPODgIhhgFmWW0AvE1+lD6m 3cXQ== X-Gm-Message-State: AFeK/H2WVhb0Y/BkJRZsXvgn9b9IAomRdTHnjwpSufgNOyg1ZC2olH918rl8TEYtg9dYaVhC9a2daj/ULvGq+nTE X-Received: by 10.107.141.134 with SMTP id p128mr21816299iod.83.1490080057494; Tue, 21 Mar 2017 00:07:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.10.27 with HTTP; Tue, 21 Mar 2017 00:07:37 -0700 (PDT) In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B836441@shsmsx102.ccr.corp.intel.com> References: <1490021496-10195-1-git-send-email-ard.biesheuvel@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103B836441@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Tue, 21 Mar 2017 07:07:37 +0000 Message-ID: To: "Zeng, Star" Cc: "edk2-devel@lists.01.org" , "Tian, Feng" Subject: Re: [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 07:07:38 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 21 March 2017 at 01:28, Zeng, Star wrote: > Reviewed-by: Star Zeng > Pushed as f859c6796f40, thanks > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Monday, March 20, 2017 10:52 PM > To: edk2-devel@lists.01.org; Zeng, Star ; Tian, Feng= > Cc: Ard Biesheuvel > Subject: [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when re= moving tables > > Invocations of EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() may result i= n a crash when the value of PcdAcpiExposedTableVersions does not include EF= I_ACPI_TABLE_VERSION_1_0B. > > The reason is that EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable() will only = populate the Rsdt1/Rsdt3 pointers when EFI_ACPI_TABLE_VERSION_1_0B is set, = whereas EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() will invoke PublishTa= bles with EFI_ACPI_TABLE_VERSION_1_0B alawys set, resulting in a NULL point= er dereference of the Rsdt1/Rsdt3 pointers. > > So take PcdAcpiExposedTableVersions into account for UninstallAcpiTable a= s well. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c= b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > index 4bb848df5203..a635e1de5a7c 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > @@ -290,24 +290,27 @@ UninstallAcpiTable ( { > EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance; > EFI_STATUS Status; > + EFI_ACPI_TABLE_VERSION Version; > > // > // Get the instance of the ACPI table protocol > // > AcpiTableInstance =3D EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This); > > + Version =3D PcdGet32 (PcdAcpiExposedTableVersions); > + > // > // Uninstall the ACPI table > // > Status =3D RemoveTableFromList ( > AcpiTableInstance, > - EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0, > + Version, > TableKey > ); > if (!EFI_ERROR (Status)) { > Status =3D PublishTables ( > AcpiTableInstance, > - EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0 > + Version > ); > } > > -- > 2.7.4 >