public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler
@ 2018-07-19 10:00 Zhang, Chao B
  2018-07-20  6:40 ` Long, Qin
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Chao B @ 2018-07-19 10:00 UTC (permalink / raw)
  To: edk2-devel; +Cc: Long Qin, Yao Jiewen, Chao Zhang

Add more logic to filter invalid function parameter in MOR Control SMI handler

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler
  2018-07-19 10:00 [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler Zhang, Chao B
@ 2018-07-20  6:40 ` Long, Qin
  0 siblings, 0 replies; 2+ messages in thread
From: Long, Qin @ 2018-07-20  6:40 UTC (permalink / raw)
  To: Zhang, Chao B, edk2-devel@lists.01.org; +Cc: Yao, Jiewen

Reviewed-by: Long Qin <qin.long@intel.com>


Best Regards & Thanks,
LONG, Qin

> -----Original Message-----
> From: Zhang, Chao B
> Sent: Thursday, July 19, 2018 6:00 PM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin <qin.long@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Zhang, Chao B <chao.b.zhang@intel.com>
> Subject: [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI
> handler
> 
> Add more logic to filter invalid function parameter in MOR Control SMI handler
> 
> Cc: Long Qin <qin.long@intel.com>
> Cc: Yao Jiewen <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
> ---
>  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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-20  6:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19 10:00 [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler Zhang, Chao B
2018-07-20  6:40 ` Long, Qin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox