MTCP base specification marks EIDs 1-7 as reserved. Therefore return
EFI_INVALID_PARAMETER if such EIDs were provided to the
MctpSubmitMessage function.

Signed-off-by: Konstantin Aladyshev <aladyshe...@gmail.com>
Signed-off-by: Abner Chang <abner.ch...@amd.com>
---
 .../Universal/MctpProtocol/Dxe/MctpProtocol.c   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git 
a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c 
b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c
index 88bfd9b7e7..d0f49a1abb 100644
--- a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c
+++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c
@@ -78,6 +78,23 @@ MctpSubmitMessage (
     return EFI_INVALID_PARAMETER;
   }
 
+  //
+  // Check source EID and destination EID
+  //
+  if ((MctpSourceEndpointId >= MCTP_RESERVED_ENDPOINT_START_ID) &&
+      (MctpSourceEndpointId <= MCTP_RESERVED_ENDPOINT_END_ID)
+      ) {
+    DEBUG ((DEBUG_ERROR, "%a: The value of MCTP source EID (%x) is 
reserved.\n", __func__, MctpSourceEndpointId));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if ((MctpDestinationEndpointId >= MCTP_RESERVED_ENDPOINT_START_ID) &&
+      (MctpDestinationEndpointId <= MCTP_RESERVED_ENDPOINT_END_ID)
+      ) {
+    DEBUG ((DEBUG_ERROR, "%a: The value of MCTP destination EID (%x) is 
reserved.\n", __func__, MctpDestinationEndpointId));
+    return EFI_INVALID_PARAMETER;
+  }
+
   Status = CommonMctpSubmitMessage (
              mTransportToken,
              MctpType,
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109852): https://edk2.groups.io/g/devel/message/109852
Mute This Topic: https://groups.io/mt/102080229/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to