From: Benjamin Herrenschmidt <b...@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 <b...@kernel.crashing.org>
Reviewed-by: Leo Sandoval <lsand...@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


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to