grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Leo Sandoval
Subject: [PATCH] term/nns8250-spcr: return if redirection is disabled
Date: Tue, 21 Jan 2025 11:01:26 -0600

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

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.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Leo Sandoval <lsandova@redhat.com>
---
 grub-core/term/ns8250-spcr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/grub-core/term/ns8250-spcr.c b/grub-core/term/ns8250-spcr.c
index 4efaaf768..fc3bddeaf 100644
--- a/grub-core/term/ns8250-spcr.c
+++ b/grub-core/term/ns8250-spcr.c
@@ -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:
-- 
2.47.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]