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: 143888 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2984664ljj; Thu, 9 Aug 2018 23:47:28 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyOSifo6K3JlTbbtKZwz6jXgToDCxV4/dXSY9bdWfrug7CHjpq4GVGvwpbfXNpTz+m7+ymR X-Received: by 2002:a50:8ca9:: with SMTP id q38-v6mr6931766edq.2.1533883648470; Thu, 09 Aug 2018 23:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533883648; cv=none; d=google.com; s=arc-20160816; b=SWt9qr1N36beKmfxCWoOqwaW+ik2pNOabvS3SMKHOUe/9rJy9BuJxUWU6uhN1JntIL uEwfL2vWEUv/aWN+9Xr88mZSiZmeOA1yCG6SFgNDY8xOSsYVTFx7rw9TnlT/v0EVl6u7 EhaKSyOXTdghX5WbeDIpXpi6+85vSKzQPcT+YNUhCVPV3UBsvlPN2ZlWgJuvpDBEZ5yi I0pRABrQlclUZmunI6+Y9/5PBnm3MHEMiW8ob8X/1qsDegpZWZ7sSFFBuJJGVIC4ZzmO 4SlewCn2zpPZDmncL6odT2Qh94fb0yhM8vUe3Zt2kLEZ1jwr3DFlf1auT9VuqaYG2FP3 SNgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=Yjsh3zTnvrbCURdpdbDQzulf7qNPn8/t+0f7BgBpc9U=; b=n1DPNJPsz1p7BclPEMF9EaSe/alK8czmOiIQ2Ici2szV2rQs7RbVULB4/iOf/Jj13Z SGDwAzDj/db97dGBZZu7qBpPGEpvTjY6gW8H/Jge22IFzvxodk+P5GCvWupXmJY1xG+Z qk1rnoQqerITMuls1tAX1pGM8smKF0N74fpwCnOjB0R9zRbUf5sIhRYZX+lJsxkEoWwo yWyqwZcOLyE67NJIi/k87lc2yVYe5fcxvdS2RKrhXUx8n+zD9E+naHEADFnx5+bwcgV+ p/18EVcbm99E+p3HVXaAhDjWw0jB3K7m6xwoOXkmcNOm+Kk2QLKfkRrskhUctqqApjtg Jq7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YwRnq6Oe; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id b19-v6si3065305edb.96.2018.08.09.23.47.28; Thu, 09 Aug 2018 23:47:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YwRnq6Oe; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id E46ECC21E56; 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-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));