public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: Peter Jones <pjones@redhat.com>,
	"edk2-devel@ml01.01.org" <edk2-devel@ml01.01.org>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice.
Date: Thu, 29 Sep 2016 18:38:17 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F56481DCC7@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <20160929174501.12323-1-pjones@redhat.com>

Peter,

Please use this form in your patch.  The UEFI Spec does allow other error codes than
those listed in the API to be returned.  Using !EFI_ERROR (Status) is safer.  EDK II
Coding Style also requires {} for if statements.

  Status = gBS->LocateProtocol (&gEfiPkcs7VerifyProtocolGuid, NULL, (VOID **)&Useless);
  if (!EFI_ERROR (Status)) {
    return EFI_ABORTED;
  }

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Peter Jones
> Sent: Thursday, September 29, 2016 10:45 AM
> To: edk2-devel@ml01.01.org
> Cc: Peter Jones <pjones@redhat.com>
> Subject: [edk2] [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols
> twice.
> 
> This patch makes Pkcs7VerifyDxe check that it has not already been
> installed before installing its protocols.  This prevents the case where
> loading it as an external driver (either manually, through Driver####
> variables, etc.) will refuse to add a second provider of the API.
> 
> v2 - return EFI_ABORTED as per Michael Kinney's feedback.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Peter Jones <pjones@redhat.com>
> ---
>  SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> b/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> index 07fdf55..7927c58 100644
> --- a/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> +++ b/SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.c
> @@ -1030,8 +1030,16 @@ Pkcs7VerifyDriverEntry (
>    IN EFI_SYSTEM_TABLE    *SystemTable
>    )
>  {
> -  EFI_STATUS    Status;
> -  EFI_HANDLE    Handle;
> +  EFI_STATUS                Status;
> +  EFI_HANDLE                Handle;
> +  EFI_PKCS7_VERIFY_PROTOCOL Useless;
> +
> +  //
> +  // Avoid loading a second copy if this is built as an external module.
> +  //
> +  Status = gBS->LocateProtocol (&gEfiPkcs7VerifyProtocolGuid, NULL, (VOID **)
> &Useless);
> +  if (Status != EFI_NOT_FOUND)
> +	  return EFI_ABORTED;
> 
>    //
>    // Install UEFI Pkcs7 Verification Protocol
> --
> 2.10.0
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2016-09-29 18:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 15:59 [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice Peter Jones
2016-09-29 16:33 ` Kinney, Michael D
2016-09-29 17:45   ` Peter Jones
2016-09-29 18:38     ` Kinney, Michael D [this message]
2016-09-29 18:39       ` Peter Jones
2016-09-29 18:45       ` Peter Jones
2016-09-29 18:48         ` Kinney, Michael D
2016-09-30  1:06           ` Long, Qin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E92EE9817A31E24EB0585FDF735412F56481DCC7@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox