From patchwork Tue Dec 3 16:13:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 846962 Delivered-To: patch@linaro.org Received: by 2002:a5d:44cd:0:b0:385:e875:8a9e with SMTP id z13csp582435wrr; Tue, 3 Dec 2024 08:13:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVPT9nh3vGWm1yNEOkBMfi7Dj/t+xsCIw40Y5mgANxOn9Meq2lxw/JQUwYO/+ryXc+Va9HbWQ==@linaro.org X-Google-Smtp-Source: AGHT+IGyIYyRWJsRfzN+J7kgXJjRdif2LpDOI79ZWqR/Wx5WEMVCh7MY0fpr/feLJ5veh4lHWbPz X-Received: by 2002:a05:6402:4006:b0:5d0:c649:b2ba with SMTP id 4fb4d7f45d1cf-5d10cb9955emr3124288a12.32.1733242427792; Tue, 03 Dec 2024 08:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733242427; cv=none; d=google.com; s=arc-20240605; b=cqi4T/AKvtklN3SAVPr6kB9tj4AU+Ebp+rAO9SJDNHr9xjOKwCWQGoBXjMb2ZZzlru zR9oyTVRLshuEtqrQoA9XZ/5FIMS/rki1Ndt0ChDeUbSfJXQmi1+ua69DtDiL9xp4AsK 5G3UUGt87buUl6O+7wQ/w1bUJY4pnJseQqV4rIdFbtlXMXPNMbwRcy1/oaLwJARB5dNz XsCZ6MUoyPpGTqhNaLmwCFlj8dwprWaQmwey+pbehexWbDjnya748ZzARTR/k6AICHJF hRiuaQHeWaEKw9vlSAz/diZQNkrVEpmrmV4UGrCbBzmoCR7zM81LsHX30M2f+dmKm13M SWBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=cKsOx1urn+2JQO0EPZ3H4Hcl2nAYRVvr8/ZVUkKMYaE=; fh=SgWS7yxrHCByGiTtzh/MgjhvQ6if/+VW6496hQ7VDvM=; b=P4o4ji9eMBj/lkrq1o0//8/HaN4l4hCNuE86FQmR8cI9MUPzC81CkFXWRDDDICGl+j 5Yde8qNhX59y0we1sGGNL4omE6b8HtotDc1LFtDfiRq86gsjx8KD11sPCkiC9TllyXk5 tY+1V/qGqkveK71U/cRvLyCWSYXFiVx67Kcn3rEaod+cvv4LKlu2bCR8JU7itNW395Tr SVVhicmHqMKUTr8LQQTfc8H5C1HWqMsahy203V8+Zpf0FzgcYUlImACjA8avfnt9qs3c xOK0llpqO+V5rLtgYwvtS59QciNFqBHyd2vTHzpcVesQGDLdbbenPY0h61Aknh+pY/7V QQSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dn+6mUWA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d097daea92si8988701a12.170.2024.12.03.08.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 08:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dn+6mUWA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8B9E188EA8; Tue, 3 Dec 2024 17:13:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Dn+6mUWA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5FB6588E6F; Tue, 3 Dec 2024 17:13:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 407B2893D6 for ; Tue, 3 Dec 2024 17:13:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5ceb03aadb1so6811757a12.0 for ; Tue, 03 Dec 2024 08:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733242423; x=1733847223; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cKsOx1urn+2JQO0EPZ3H4Hcl2nAYRVvr8/ZVUkKMYaE=; b=Dn+6mUWAH6B2KDWVAOPo+10fbAyqxOe0YctjDnWpGYbUhiBxh2fypHtwfa+2FrWWh4 F7ulzX+orTcACZWi+LQWxh5i1KGg0TmjOXViw8MVAfhrByNXYWo33k1gqvo4Rd8D1uXM 5HMBibrNvslU1YKaygtjqFp82Zclo0ufTXwphqsp8ti/bIe2mZK8/1VM5f1ciuG0XXnM HINpyfSUG6GFB+SIUMpt6t2ql1lOQ4sx40me8kBzRF2iZKxZRWBUO8wA2LDTe0szU2ds QBB+sx8SWitodV636cKLfhWWyC7OU7M+YEWeDsU3rMiIRKlTCT3g/ZagaylKNVFyk8R+ O5vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733242423; x=1733847223; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cKsOx1urn+2JQO0EPZ3H4Hcl2nAYRVvr8/ZVUkKMYaE=; b=YMwvaOpG31jykdNuYSvV4IflNcQR9ugei4P1WqwMMpiklUxRzRvL2l58FL4KrOL0Mu A0KrapM/lOcQc1spIgUvFnPj7nDLNKOMgBZ9qmIzklcFziYJTvRmsdHnJLDtxe0A4uPZ nebOC8fHkkCMHOlXkM5u0nOcYL+vMxYQy3dpZx2A++i07QdRf37GMDg09ydloSG4sA9c vz2rFULAv4AGgMG7Qc1jjTyYaR/DbhZtRTZu4ssDx9JOTW+G/vZzjy1nx6MamjEUrgeV /TY/XMmFD6LypsSu98HWDT1Ne3CIoZKYsGL1uLv2JsPqngQMvc4O7xCMgvektqpfXBkC Fxpw== X-Forwarded-Encrypted: i=1; AJvYcCVIZnxHw7B5dCeJp6vam/23HhRWGUrIxVB72R2YuqIhai3ax8e9y2MAHWYHy1VY7Qs4tkN6hPI=@lists.denx.de X-Gm-Message-State: AOJu0YwKXkTtYKKR6YrlUOX+UtsH/DL8wKrKIkCMuvJYBIvusf3sPJD8 992otdkxGeNlbHgBo1kgI/k42Sm0W0cazwZMrbgoawhi5JGUwnq2QhRoE2d4wj8= X-Gm-Gg: ASbGnctevksvNH4EIQUe42yXRXmLRXDmRlm+99XFh+OMJ5wtb62EEorDoRnENGs0xDk DnU2f3ZHmJRocoHOaRTamywT3fRrMEH2q2x/zApvwXlepnmZpTqwDdQDICluQQG73vwfaqfV7Wf 9lXJ3byFyQUHZJgxzkoUxiTfz79BuTsa/d6fX0w3cAsKCyvip/7kkYKQyEOeSNzKElg3zkwnkMp ZoAqaAjEI5a4MwBNxpHFeVm5v5Nyoa9UcOwtzdFUnE9REa0ZYpsSVE8/oqiFXV+uomj8PRTHTXB Ja5QfN7RmtTb26P9fdwd/dUbJMs= X-Received: by 2002:a05:6402:378a:b0:5cf:c0d2:698 with SMTP id 4fb4d7f45d1cf-5d10cb5baf9mr3129039a12.18.1733242422579; Tue, 03 Dec 2024 08:13:42 -0800 (PST) Received: from localhost.localdomain (ppp176092181030.access.hol.gr. [176.92.181.30]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d0e04ec755sm3139262a12.62.2024.12.03.08.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 08:13:42 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: Ilias Apalodimas , Tom Rini , Masahisa Kojima , Caleb Connolly , Simon Glass , u-boot@lists.denx.de Subject: [PATCH] efi_loader: Check for a valid fw_name before auto generating GUIDs Date: Tue, 3 Dec 2024 18:13:37 +0200 Message-ID: <20241203161338.1814537-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The gen_v5_guid() is a void and does no error checking with pointers being available etc. Instead it expects all things to be in place to generate GUIDs. If a board capsule definition is buggy and does not define the firmware names when enabling capsule updates, the board will crash trying to bring up the EFI subsystem. Check for a valid firmware name before generating GUIDs. Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt Reviewed-by: Caleb Connolly --- lib/efi_loader/efi_firmware.c | 4 ++++ 1 file changed, 4 insertions(+) - 2.45.2 diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 6650c2b8071d..112775daf4c3 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -281,6 +281,10 @@ static efi_status_t efi_gen_capsule_guids(void) } for (i = 0; i < update_info.num_images; i++) { + if (!fw_array[i].fw_name) { + log_err("fw_name is not defined. Not generating capsule GUIDs\n"); + return EFI_INVALID_PARAMETER; + } gen_v5_guid(&namespace, &fw_array[i].image_type_id, compatible, strlen(compatible),