From patchwork Fri Aug 10 06:36:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 956013 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YwRnq6Oe"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41mwft57JQz9s4Z for ; Fri, 10 Aug 2018 16:47:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 33B40C21DCA; Fri, 10 Aug 2018 06:46:53 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID 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 47243C21BE5; Fri, 10 Aug 2018 06:46:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 892A0C21E77; Fri, 10 Aug 2018 06:36:53 +0000 (UTC) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by lists.denx.de (Postfix) with ESMTPS id 86054C21E3E for ; Fri, 10 Aug 2018 06:36:52 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id a11-v6so3924368pgw.6 for ; Thu, 09 Aug 2018 23:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8Wrjqd7cbWmgnQWEhtDqY+DPAARfc1qyVQFeX34gSEM=; b=YwRnq6Oek6rEEQLJ/Ij3osTIm/quZxG5m2/kujtNF00w5VXd5UiB6ui8MP2vIZMNJk KaGkPVDDyrbPvtsqA8meqWGGtq3xLqWkpamVgdTGPNCgqh5U85OUE+1AL85jFZM2h/tA 8m+ykG3gJYO2YSxnx/ZADnYPnsWg6r0mIIMe8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8Wrjqd7cbWmgnQWEhtDqY+DPAARfc1qyVQFeX34gSEM=; b=EAjBeq5x94pye5NSo7OIli6Ryj2kk6rzi+jNruYGCddlfJ+iWYiBB0RzSfkSR/zCzK 95ZxNNk9YBGpHxzP+aPEBcfBXVE2xLD3RqtZAYo3YT0M9a5Au+QEKFblSUxJ9b7LpQd0 h0htepuJrp5TVgcxX4EeMjMAwJtm8OfrSkI8yYPstMnHTO8zx4wuTLGRGUGXVdGjFADI 0Mw5PRrVF7RBoHMdE5A5BTlVt0jfcbSbJWOZuguel/ll8lQmzisAWMif1nr56aUeTK5b QYZ9Eld+dJq10ckYp9RFYXkVVOeS+u/v66IbzXJw/tZuU/XvRgSOoEcYqaUgURO5wiFY 2jow== X-Gm-Message-State: AOUpUlGwR1Pv7zk2xA13ZJCI3EOnajLrPTMoqRAvbtohA+B9qoiJF9MA RuTBuo9ngAKYwKU7/1rrqpbu2A== X-Google-Smtp-Source: AA+uWPx66KJbU717hTPXF8Kjkfr6yRHTfErrQ255q9pDEBy0ayvjCteFrWmZ6XkRzWf0oVyNkxdT5A== X-Received: by 2002:a63:f002:: with SMTP id k2-v6mr5035546pgh.8.1533883011206; Thu, 09 Aug 2018 23:36:51 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id w192-v6sm10169425pfd.74.2018.08.09.23.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 23:36:50 -0700 (PDT) From: AKASHI Takahiro To: agraf@suse.de Date: Fri, 10 Aug 2018 15:36:32 +0900 Message-Id: <20180810063632.10979-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de Subject: [U-Boot] [PATCH] efi_loader: fix a parameter check at CreateEvent() 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" The commit 21b3edfc9644 ("efi_loader: check parameters of CreateEvent") enforces a strict parameter check at CreateEvent(). On the other hand, UEFI specification version 2.7, section 7.1, says: The EVT_NOTIFY_WAIT and EVT_NOTIFY_SIGNAL flags are exclusive. If neither flag is specified, the caller does not require any notification concerning the event and the NotifyTpl, NotifyFunction, and NotifyContext parameters are ignored. So the check should be mitigated so as to comply with the specification. Without this patch, EDK2's Shell.efi won't be started. Fixes: 21b3edfc9644 ("efi_loader: check parameters of CreateEvent") Signed-off-by: AKASHI Takahiro Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ac8f484507bd..f3fba3190981 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -627,7 +627,8 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, return EFI_INVALID_PARAMETER; } - if (is_valid_tpl(notify_tpl) != EFI_SUCCESS) + if ((type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) && + (is_valid_tpl(notify_tpl) != EFI_SUCCESS)) return EFI_INVALID_PARAMETER; evt = calloc(1, sizeof(struct efi_event));