From nobody Sat May 4 05:05:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 153199444423852.05686926376677; Thu, 19 Jul 2018 03:00:44 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BD8812098C8D0; Thu, 19 Jul 2018 03:00:43 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 74F7D2097DD37 for ; Thu, 19 Jul 2018 03:00:41 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2018 03:00:41 -0700 Received: from czhan46-mobl1.ccr.corp.intel.com ([10.255.29.208]) by fmsmga004.fm.intel.com with ESMTP; 19 Jul 2018 03:00:09 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=chao.b.zhang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,374,1526367600"; d="scan'208";a="72649914" From: "Zhang, Chao B" To: edk2-devel@lists.01.org Date: Thu, 19 Jul 2018 18:00:05 +0800 Message-Id: <20180719100005.9816-1-chao.b.zhang@intel.com> X-Mailer: git-send-email 2.11.0.windows.1 Subject: [edk2] [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yao Jiewen , Chao Zhang , Long Qin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add more logic to filter invalid function parameter in MOR Control SMI hand= ler Cc: Long Qin Cc: Yao Jiewen Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang Signed-off-by: Zhang, Chao B Reviewed-by: Long Qin --- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 4 ++++ SecurityPkg/Tcg/TcgSmm/TcgSmm.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tc= g2Smm.c index 21b1014a3b..4a1a293bfc 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -151,10 +151,14 @@ MemoryClearCallback ( =20 if (MOR_CLEAR_MEMORY_VALUE (MorControl) =3D=3D 0x0) { return EFI_SUCCESS; } MorControl &=3D ~MOR_CLEAR_MEMORY_BIT_MASK; + } else { + mTcgNvs->MemoryClear.ReturnCode =3D MOR_REQUEST_GENERAL_FAILURE; + DEBUG ((EFI_D_ERROR, "[TPM] MOR Parameter error! Parameter =3D %x\n", = mTcgNvs->MemoryClear.Parameter)); + return EFI_SUCCESS; } =20 DataSize =3D sizeof (UINT8); Status =3D mSmmVariable->SmmSetVariable ( MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c b/SecurityPkg/Tcg/TcgSmm/TcgSm= m.c index 0b8a002a4d..d3ddae6886 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c @@ -269,10 +269,14 @@ MemoryClearCallback ( =20 if (MOR_CLEAR_MEMORY_VALUE (MorControl) =3D=3D 0x0) { return EFI_SUCCESS; } MorControl &=3D ~MOR_CLEAR_MEMORY_BIT_MASK; + } else { + mTcgNvs->MemoryClear.ReturnCode =3D MOR_REQUEST_GENERAL_FAILURE; + DEBUG ((EFI_D_ERROR, "[TPM] MOR Parameter error! Parameter =3D %x\n", = mTcgNvs->MemoryClear.Parameter)); + return EFI_SUCCESS; } =20 DataSize =3D sizeof (UINT8); Status =3D mSmmVariable->SmmSetVariable ( MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel