From patchwork Sun Mar 12 08:26:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Gray X-Patchwork-Id: 737794 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3vgvHT5k0kz9s7K for ; Sun, 12 Mar 2017 19:27:01 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 73691C21C80; Sun, 12 Mar 2017 08:26:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2BF59C21C54; Sun, 12 Mar 2017 08:26:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 34BC9C21C7C; Sun, 12 Mar 2017 08:26:21 +0000 (UTC) Received: from lechuck.jsg.id.au (jsg.id.au [210.15.216.215]) by lists.denx.de (Postfix) with ESMTPS id 3CE8EC21BE5 for ; Sun, 12 Mar 2017 08:26:16 +0000 (UTC) Received: from largo.jsg.id.au (largo.jsg.id.au [192.168.1.43]) by lechuck.jsg.id.au (OpenSMTPD) with ESMTP id 21a01500; Sun, 12 Mar 2017 19:26:07 +1100 (AEDT) Received: from largo.jsg.id.au (localhost [127.0.0.1]) by largo.jsg.id.au (OpenSMTPD) with ESMTP id 4e92504e; Sun, 12 Mar 2017 19:26:07 +1100 (AEDT) From: Jonathan Gray To: u-boot@lists.denx.de Date: Sun, 12 Mar 2017 19:26:07 +1100 Message-Id: <20170312082607.58540-2-jsg@jsg.id.au> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170312082607.58540-1-jsg@jsg.id.au> References: <20170312082607.58540-1-jsg@jsg.id.au> Subject: [U-Boot] [PATCH 2/2] efi_loader: check CreateEvent() parameters X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add some of the invalid parameter checks described in the UEFI specification for CreateEvent(). This does not include checking the validity of the type and tpl parameters. Signed-off-by: Jonathan Gray Acked-By: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index eb5946a959..7172b690a5 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -189,6 +189,16 @@ static efi_status_t EFIAPI efi_create_event( return EFI_EXIT(EFI_OUT_OF_RESOURCES); } + if (event == NULL) + return EFI_EXIT(EFI_INVALID_PARAMETER); + + if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT)) + return EFI_EXIT(EFI_INVALID_PARAMETER); + + if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) && + notify_function == NULL) + return EFI_EXIT(EFI_INVALID_PARAMETER); + efi_event.type = type; efi_event.notify_tpl = notify_tpl; efi_event.notify_function = notify_function;