From nobody Sun May 5 08:46:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60221+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60221+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1590430914; cv=none; d=zohomail.com; s=zohoarc; b=XgDpsdDtcRuK1a4tqoNmM1XB5A4rUWLK51Q5eOIx8IMxQzdSh08dk/oPInJ7tUD7y0AFHUrcL0nafHiXQ5HtZNqX/X5Vt3i49j7itBz8TIPW7hw/Ne27Ys3kSToOFrf51WGV5W83q2aWNRewA4AfJ+mSZ0sVnr1M4/h2oshWDXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590430914; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=G5Wlf1MWAMIXIIkYbPTSU93FE67iuy3mMFr8n25BMTc=; b=ewsI+e+8nTsO2aAptA5omyqUPpa5QEg0pIqZJm6eegnNl0ZEIckuHsSa2KXGBqYUM+/c2sAlxg6uv6gjx7axTiBTJhmmfKvIU24hiR8j2qWSsIgFh+4gHiIEZfmFs6uKVv7zaqiE/gu1hoIsH6nTT7MKpOcYjev0APSmXsgl0YY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60221+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 159043091420358.157756142536414; Mon, 25 May 2020 11:21:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9XcjYY1788612xiNBiD7wkJL; Mon, 25 May 2020 11:21:53 -0700 X-Received: from huawei.com (huawei.com [45.249.212.32]) by mx.groups.io with SMTP id smtpd.web11.29557.1590406596321143176 for ; Mon, 25 May 2020 04:36:36 -0700 X-Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 44BD010F9364AA6BCBC0 for ; Mon, 25 May 2020 19:36:32 +0800 (CST) X-Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Mon, 25 May 2020 19:36:25 +0800 From: Ming Huang To: , , , CC: , , , , , Subject: [edk2-devel] [RFC edk2 v1 1/1] MdeModulePkg/Variable: Move FindVariable after AutoUpdateLangVariable Date: Mon, 25 May 2020 19:34:18 +0800 Message-ID: <1590406458-59742-2-git-send-email-huangming23@huawei.com> In-Reply-To: <1590406458-59742-1-git-send-email-huangming23@huawei.com> References: <1590406458-59742-1-git-send-email-huangming23@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.68.188] X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,huangming23@huawei.com X-Gm-Message-State: H9yPoGCbOhYbY8PxCcfMUqE3x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590430913; bh=GE8gEy1enVCBuBtZD0ToJDRA0EaioAuFYbT1EQEQdjs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mSM2queE3oxpCAJmvJ9r8BFiodd0/waw7L1A5R5DuI7JeMkOfgaUC4e43ocFK9vVtXe UElXN9fx5Gb5Sr239sXeeMYvpT1zoZKyH6FewiG127HU4lWeGnGmD+Gf17Rv2ud2wDTfU W1NfWuKgKI108nn9TnEsjOwngaGOE7K4inc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When occur reclaim in AutoUpdateLangVariable(), the CurrPtr of Variable is invalid. The State will be update with wrong position after UpdateVariable in this situation and two valid PlatformLang or Lang variables will exist. BmForEachVariable() will enter endless loop while exist two valid PlatformLang variables. So FindVariable() should be invoked atfer AutoUpdateLangVariable(). https://bugzilla.tianocore.org/show_bug.cgi?id=3D2667 Signed-off-by: Ming Huang --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 26 ++++++++++-----= ----- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.c index 1e71fc6..0cec981 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -2741,6 +2741,19 @@ VariableServiceSetVariable ( mVariableModuleGlobal->NonVolatileLastVariableOffset =3D (UINTN) NextV= ariable - (UINTN) Point; } =20 + if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { + // + // Hook the operation of setting PlatformLangCodes/PlatformLang and La= ngCodes/Lang. + // + Status =3D AutoUpdateLangVariable (VariableName, Data, DataSize); + if (EFI_ERROR (Status)) { + // + // The auto update operation failed, directly return to avoid incons= istency between PlatformLang and Lang. + // + goto Done; + } + } + // // Check whether the input variable is already existed. // @@ -2763,19 +2776,6 @@ VariableServiceSetVariable ( } } =20 - if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { - // - // Hook the operation of setting PlatformLangCodes/PlatformLang and La= ngCodes/Lang. - // - Status =3D AutoUpdateLangVariable (VariableName, Data, DataSize); - if (EFI_ERROR (Status)) { - // - // The auto update operation failed, directly return to avoid incons= istency between PlatformLang and Lang. - // - goto Done; - } - } - if (mVariableModuleGlobal->VariableGlobal.AuthSupport) { Status =3D AuthVariableLibProcessVariable (VariableName, VendorGuid, D= ata, DataSize, Attributes); } else { --=20 2.8.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60221): https://edk2.groups.io/g/devel/message/60221 Mute This Topic: https://groups.io/mt/74462883/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-