From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id A33EBAC124F for ; Fri, 20 Oct 2023 12:53:27 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=IwC1+YTHPkvFXkxqvb427TWjWN9I2UXS08pA19/VOP8=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1697806406; v=1; b=tVjIXxYerdSZfGTaggpXeYpuH07thwk1bO1YDe6j3PHXZdVAOXw+wbAVqKGgDs8bb7jZ5KmB gxq9+ma0bhKaETOVM/ZFhSs3OO5oIPfgrFxaeM5Sfi+hIiRCo7WIJpQEcwIVzEbuBkHzlFz7k/5 uAVhqq8uZk2HztD/AuY4mjHk= X-Received: by 127.0.0.2 with SMTP id cXHeYY7687511xjHM0zcSpUG; Fri, 20 Oct 2023 05:53:26 -0700 X-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.53395.1697806405611441783 for ; Fri, 20 Oct 2023 05:53:25 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2bb9a063f26so11141201fa.2 for ; Fri, 20 Oct 2023 05:53:25 -0700 (PDT) X-Gm-Message-State: kNewiC9k3VpXAJ60ZvUMUxovx7686176AA= X-Google-Smtp-Source: AGHT+IH3U03e7v6A1SaDkFNkDUfIaM4WgyftbSeoQAMJ9CTREo4Pv8a0PgUOLeoUdyTEoDCL90Du9A== X-Received: by 2002:a2e:9658:0:b0:2c5:16c0:6239 with SMTP id z24-20020a2e9658000000b002c516c06239mr1254128ljh.51.1697806403453; Fri, 20 Oct 2023 05:53:23 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id x22-20020a05651c105600b002b9e5fe86dasm350853ljm.81.2023.10.20.05.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:22 -0700 (PDT) From: "Konstantin Aladyshev" To: devel@edk2.groups.io Cc: abner.chang@amd.com, isaac.w.oram@intel.com, AbdulLateef.Attar@amd.com, nicklew@nvidia.com, Konstantin Aladyshev Subject: [edk2-devel] [PATCH edk2-platforms v2 14/15] ManageabilityPkg: Return error on PLDM header check fails Date: Fri, 20 Oct 2023 15:53:01 +0300 Message-Id: <20231020125302.1459-15-aladyshev22@gmail.com> In-Reply-To: <20231020125302.1459-1-aladyshev22@gmail.com> References: <20231020125302.1459-1-aladyshev22@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,aladyshev22@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=tVjIXxYe; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Currently PldmSubmit command returns EFI_SUCCESS even if the response header checks have failed. Correct the code to return errors in such cases. Signed-off-by: Konstantin Aladyshev --- .../Universal/PldmProtocol/Common/PldmProtocolCommon.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index bc72ce07b3..04f250e57c 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -241,7 +241,7 @@ CommonPldmSubmitCommand ( if (FullPacketResponseData =3D=3D NULL) {=0D DEBUG ((DEBUG_ERROR, " Not enough memory for FullPacketResponseDataSi= ze.\n"));=0D Status =3D EFI_OUT_OF_RESOURCES;=0D - goto ErrorExit2;=0D + goto ErrorExit;=0D }=0D =0D // Print out PLDM packet.=0D @@ -281,6 +281,7 @@ CommonPldmSubmitCommand ( FullPacketResponseDataSize=0D ));=0D HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n");=0D + Status =3D EFI_DEVICE_ERROR;=0D goto ErrorExit;=0D }=0D =0D @@ -303,6 +304,7 @@ CommonPldmSubmitCommand ( DEBUG ((DEBUG_ERROR, " Pldm Completion Code =3D 0x%x\n", ResponseHe= ader->PldmCompletionCode));=0D =0D HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n");=0D + Status =3D EFI_DEVICE_ERROR;=0D goto ErrorExit;=0D }=0D =0D @@ -319,6 +321,7 @@ CommonPldmSubmitCommand ( ));=0D =0D HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n");=0D + Status =3D EFI_DEVICE_ERROR;=0D goto ErrorExit;=0D }=0D =0D @@ -332,6 +335,7 @@ CommonPldmSubmitCommand ( ResponseHeader->PldmCompletionCode=0D ));=0D HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, GET_PLD= M_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte), "Fa= iled response payload\n");=0D + Status =3D EFI_DEVICE_ERROR;=0D goto ErrorExit;=0D }=0D =0D @@ -350,13 +354,12 @@ CommonPldmSubmitCommand ( =0D // Return transfer status.=0D //=0D -ErrorExit:=0D Status =3D TransferToken.TransferStatus;=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a: Failed to send PLDM command over %s\n", __fu= nc__, mTransportName));=0D }=0D =0D -ErrorExit2:=0D +ErrorExit:=0D if (PldmTransportHeader !=3D NULL) {=0D FreePool ((VOID *)PldmTransportHeader);=0D }=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109864): https://edk2.groups.io/g/devel/message/109864 Mute This Topic: https://groups.io/mt/102080244/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-