Skip to contentSkip to conversation

term/nns8250-spcr: return if redirection is disabled

PATCH In review Leo Sandoval 2 participants 2 messages Jan 21, 2025 – Feb 20, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 term/nns8250-spcr: return if redirection is disabled

From: Benjamin Herrenschmidt <[email protected]>

The Microsoft spec for SPCR says "The base address of the Serial Port register set described using the ACPI Generic Address Structure, or 0 if console redirection is disabled." so return if disable (base address = 0). If this check is not done, we may get invalid ports for those particular machines that redirection is disabled and at some point hanging the booting execution when reading the grub.cfg configuration file.

---
 grub-core/term/ns8250-spcr.c | 5 +++++
 1 file changed, 5 insertions(+)
grub-core/term/ns8250-spcr.c +5 -0
index 4efaaf768..fc3bddeaf 100644
@@ -76,6 +76,11 @@ grub_ns8250_spcr_init (void)
         config.speed = 115200;
         break;
     };
+
+  /* if base address is 0, it means redirection is disable, so return it */
+  if (spcr->base_addr.addr == 0)
+    return NULL;
+
   switch (spcr->base_addr.space_id)
     {
       case GRUB_ACPI_GENADDR_MEM_SPACE:
Signature · 7 lines
2.47.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Leo Sandoval

From: Benjamin Herrenschmidt <[email protected]>

The Microsoft spec for SPCR says "The base address of the Serial Port register set described using the ACPI Generic Address Structure, or 0 if console redirection is disabled." so return if disable (base address = 0). If this check is not done, we may get invalid ports for those particular machines that redirection is disabled and at some point hanging the booting execution when reading the grub.cfg configuration file.

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel