mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] efi: devicepath: don't spin on hard drive nodes without a signature
@ 2026-08-26 11:44 Ahmad Fatoum
  2026-08-28 12:15 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-26 11:44 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi: devicepath: don't spin on hard drive nodes without a signature
  2026-08-26 11:44 [PATCH] efi: devicepath: don't spin on hard drive nodes without a signature Ahmad Fatoum
@ 2026-08-28 12:15 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-08-28 12:15 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Wed, 26 Aug 2026 13:44:14 +0200, Ahmad Fatoum wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] efi: devicepath: don't spin on hard drive nodes without a signature
      https://git.pengutronix.de/cgit/barebox/commit/?id=02d45a2c356d (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-28 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 11:44 [PATCH] efi: devicepath: don't spin on hard drive nodes without a signature Ahmad Fatoum
2026-08-28 12:15 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox