From nobody Fri Apr 26 07:31:33 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+61786+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+61786+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1593410958; cv=none; d=zohomail.com; s=zohoarc; b=iEnp8rB6VXJ7a9qx9l0sjCzEtuGGmtxhXVeyVWyWAPSPdBQv5OoFmAQfmHvATv6unatdePSuE4gZnu3D+LkLu9AZJRKfqHf5/mSXEQntTUROS38LJhPqdB+ceBYhd1JArXiNpa7CLSIvq8KvLuQbcEWWzdWE6nQWeB4dqPpy5eQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593410958; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=nQSmiDFBHly/1fzvdsTeTQ1LFAf5PFOTep4Mdeplvz8=; b=TlODjPJOwkzf4ULEGSHb8QjpoCo4cniiT8dm6zyYfyKv0FPM2bmHYDwqGYOk4QH1j6sfN+dR8aoRIeay5LQRTQuo6wtLbluefGlBM6IdeDJfpgS9L1kU1IHlPaiAdX2vAmEFTpxkt9nrAaJjCEzoQJxEfeBwmeyqk1MiNUS7rJY= 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+61786+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1593410958435557.4570977328868; Sun, 28 Jun 2020 23:09:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id u9JNYY1788612xzfgL8B7aJa; Sun, 28 Jun 2020 23:09:18 -0700 X-Received: from huawei.com (huawei.com [45.249.212.191]) by mx.groups.io with SMTP id smtpd.web11.13134.1593410956434783160 for ; Sun, 28 Jun 2020 23:09:16 -0700 X-Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 227A2966D60BE96640D1 for ; Mon, 29 Jun 2020 14:09:12 +0800 (CST) X-Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Mon, 29 Jun 2020 14:09:05 +0800 From: "Ming Huang via groups.io" To: , , , CC: , , , , , , Subject: [edk2-devel] [PATCH edk2 v1 1/1] MdeModulePkg/Variable: Move FindVariable after AutoUpdateLangVariable Date: Mon, 29 Jun 2020 14:06:13 +0800 Message-ID: <1593410773-62704-2-git-send-email-huangming23@huawei.com> In-Reply-To: <1593410773-62704-1-git-send-email-huangming23@huawei.com> References: <1593410773-62704-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: y2yfcTbOHv1ijLrI8biOuNI0x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1593410958; bh=xkmQfvOZZIZEhLBblYa5uuP/7qPxky7l/iIlWl/MefI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=qb4UZvvBqW45/7UVpPPiRnqKndh/Ywf2rvmAPPlsePsrvD5fwWkQ51dJL4JY8h9hTo8 +wbAqZdFGb3+m71J2ffxqOXcageGDPGWJrpGThLDpTLP+4ieDTD7IefICWlHDf/4it0DE WZ8uyUix4dUw9c27Iv9M71aiyIQPIzWrN1E= 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 (#61786): https://edk2.groups.io/g/devel/message/61786 Mute This Topic: https://groups.io/mt/75186349/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-