[AMD Official Use Only - General]

Reviewed-by: Attar, AbdulLateef (Abdul Lateef) <abdullateef.at...@amd.com>;

-----Original Message-----
From: Konstantin Aladyshev <aladyshe...@gmail.com>
Sent: Monday, October 23, 2023 6:35 PM
To: devel@edk2.groups.io
Cc: Chang, Abner <abner.ch...@amd.com>; Attar, AbdulLateef (Abdul Lateef) 
<abdullateef.at...@amd.com>; nick...@nvidia.com; Konstantin Aladyshev 
<aladyshe...@gmail.com>
Subject: [PATCH edk2-platforms v3 02/16] ManageabilityPkg: Check MCTP EIDs for 
reserved values

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


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 (#110057): https://edk2.groups.io/g/devel/message/110057
Mute This Topic: https://groups.io/mt/102134648/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to