If MCTP KCS communication has failed we need to abort MCTP transfer
function before checking any MCTP header data.
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
.../MctpProtocol/Common/MctpProtocolCommon.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c
index 3128aadd15..4aae4fcba9 100644
--- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c
+++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c
@@ -461,6 +461,13 @@ CommonMctpSubmitMessage (
&TransferToken
);
+ *AdditionalTransferError = TransferToken.TransportAdditionalStatus;
+ Status = TransferToken.TransferStatus;
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to send MCTP command over %s: %r\n", __func__, mTransportName, Status));
+ return Status;
+ }
+
MctpTransportResponseHeader = (MCTP_TRANSPORT_HEADER *)ResponseBuffer;
if (MctpTransportResponseHeader->Bits.HeaderVersion != MCTP_KCS_HEADER_VERSION) {
DEBUG ((
@@ -543,18 +550,9 @@ CommonMctpSubmitMessage (
return EFI_DEVICE_ERROR;
}
- //
- // Return transfer status.
- //
- *AdditionalTransferError = TransferToken.TransportAdditionalStatus;
*ResponseDataSize = TransferToken.ReceivePackage.ReceiveSizeInByte - sizeof (MCTP_TRANSPORT_HEADER) - sizeof (MCTP_MESSAGE_HEADER);
CopyMem (ResponseData, ResponseBuffer + sizeof (MCTP_TRANSPORT_HEADER) + sizeof (MCTP_MESSAGE_HEADER), *ResponseDataSize);
FreePool (ResponseBuffer);
- Status = TransferToken.TransferStatus;
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Failed to send MCTP command over %s: %r\n", __func__, mTransportName, Status));
- return Status;
- }
return Status;
}
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109858): https://edk2.groups.io/g/devel/message/109858
Mute This Topic: https://groups.io/mt/102080236/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-