From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,374,1526367600"; d="scan'208";a="72649914" 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 From: "Zhang, Chao B" To: edk2-devel@lists.01.org Cc: Long Qin , Yao Jiewen , Chao Zhang 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: [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: , X-List-Received-Date: Thu, 19 Jul 2018 10:00:42 -0000 Add more logic to filter invalid function parameter in MOR Control SMI handler Cc: Long Qin Cc: Yao Jiewen Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang Signed-off-by: Zhang, Chao B --- 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/Tcg2Smm.c index 21b1014a3b..4a1a293bfc 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -151,10 +151,14 @@ MemoryClearCallback ( if (MOR_CLEAR_MEMORY_VALUE (MorControl) == 0x0) { return EFI_SUCCESS; } MorControl &= ~MOR_CLEAR_MEMORY_BIT_MASK; + } else { + mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE; + DEBUG ((EFI_D_ERROR, "[TPM] MOR Parameter error! Parameter = %x\n", mTcgNvs->MemoryClear.Parameter)); + return EFI_SUCCESS; } DataSize = sizeof (UINT8); Status = mSmmVariable->SmmSetVariable ( MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c index 0b8a002a4d..d3ddae6886 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c @@ -269,10 +269,14 @@ MemoryClearCallback ( if (MOR_CLEAR_MEMORY_VALUE (MorControl) == 0x0) { return EFI_SUCCESS; } MorControl &= ~MOR_CLEAR_MEMORY_BIT_MASK; + } else { + mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE; + DEBUG ((EFI_D_ERROR, "[TPM] MOR Parameter error! Parameter = %x\n", mTcgNvs->MemoryClear.Parameter)); + return EFI_SUCCESS; } DataSize = sizeof (UINT8); Status = mSmmVariable->SmmSetVariable ( MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, -- 2.16.2.windows.1