[edk2-devel] [PATCH edk2-platforms 02/10] ManageabilityPkg: Check MCTP EIDs for reserved values

Konstantin Aladyshev aladyshev22 at gmail.com
Mon Oct 16 13:18:08 UTC 2023


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 <aladyshev22 at gmail.com>
Signed-off-by: Abner Chang <abner.chang at 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 (#109635): https://edk2.groups.io/g/devel/message/109635
Mute This Topic: https://groups.io/mt/101994939/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list