Every PLDM response contains 1 byte Completion code which is needed
to be checked against SUCCESS value which means that the PLDM command
was accepted and completed normally.
If it is not equal to that value it is necessary to return error status
so the caller would know that Response buffer is invalid.
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
.../Universal/PldmProtocol/Common/PldmProtocolCommon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
index 04f250e57c..2f2f76603e 100644
--- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
+++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
@@ -293,7 +293,8 @@ CommonPldmSubmitCommand (
(ResponseHeader->PldmHeader.RequestBit != PLDM_MESSAGE_HEADER_IS_RESPONSE) ||
(ResponseHeader->PldmHeader.InstanceId != mPldmRequestInstanceId) ||
(ResponseHeader->PldmHeader.PldmType != PldmType) ||
- (ResponseHeader->PldmHeader.PldmTypeCommandCode != PldmCommand))
+ (ResponseHeader->PldmHeader.PldmTypeCommandCode != PldmCommand) ||
+ (ResponseHeader->PldmCompletionCode != PLDM_COMPLETION_CODE_SUCCESS))
{
DEBUG ((DEBUG_ERROR, "PLDM integrity check of response data is failed.\n"));
DEBUG ((DEBUG_ERROR, " Datagram = %d (Expected value: %d)\n", ResponseHeader->PldmHeader.DatagramBit, (!PLDM_MESSAGE_HEADER_IS_DATAGRAM)));
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109924): https://edk2.groups.io/g/devel/message/109924
Mute This Topic: https://groups.io/mt/102134666/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-