public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Peter Jones <pjones@redhat.com>
To: edk2-devel@ml01.01.org
Cc: Peter Jones <pjones@redhat.com>
Subject: [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice.
Date: Thu, 29 Sep 2016 11:59:11 -0400	[thread overview]
Message-ID: <20160929155911.9838-1-pjones@redhat.com> (raw)

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.

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..3389af4 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_SUCCESS;
 
   //
   // Install UEFI Pkcs7 Verification Protocol
-- 
2.10.0



             reply	other threads:[~2016-09-29 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 15:59 Peter Jones [this message]
2016-09-29 16:33 ` [PATCH] Pkcs7VerifyDxe: Don't allow Pkcs7Verify to install protocols twice Kinney, Michael D
2016-09-29 17:45   ` Peter Jones
2016-09-29 18:38     ` Kinney, Michael D
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=20160929155911.9838-1-pjones@redhat.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