From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] efi: devicepath: don't spin on hard drive nodes without a signature
Date: Wed, 26 Aug 2026 13:44:14 +0200 [thread overview]
Message-ID: <20260826114428.2919216-1-a.fatoum@pengutronix.de> (raw)
device_path_next_compatible_node() returns the matching node itself and
doesn't advance past it, so the continue in device_path_to_partuuid()
re-enters the search with the same device path. A hard drive node whose
signature type is neither MBR nor GUID, which the UEFI specification
allows as "No Disk Signature", hangs the search in an endless loop instead
of moving on to the next node.
Advance to the next node before searching again, the way
device_path_to_filepath() does.
Assisted-by: Claude:opus-5
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
efi/devicepath.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/efi/devicepath.c b/efi/devicepath.c
index 32ddc952cd9b..fd2ad9d580c2 100644
--- a/efi/devicepath.c
+++ b/efi/devicepath.c
@@ -810,11 +810,11 @@ char *device_path_to_partuuid(const struct efi_device_path *dev_path)
struct efi_device_path_hard_drive_path *hd =
(struct efi_device_path_hard_drive_path *)dev_path;
- if (hd->signature_type != SIGNATURE_TYPE_GUID &&
- hd->signature_type != SIGNATURE_TYPE_MBR)
- continue;
+ if (hd->signature_type == SIGNATURE_TYPE_GUID ||
+ hd->signature_type == SIGNATURE_TYPE_MBR)
+ return xasprintf("%pUl", (efi_guid_t *)&(hd->signature[0]));
- return xasprintf("%pUl", (efi_guid_t *)&(hd->signature[0]));
+ dev_path = next_device_path_node(dev_path);
}
return NULL;
--
2.47.3
next reply other threads:[~2026-08-26 11:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 11:44 Ahmad Fatoum [this message]
2026-08-28 12:15 ` Sascha Hauer
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-all 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=20260826114428.2919216-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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