]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: PRM: Skip handlers with NULL handler_address or NULL VA
authorShang song (Lenovo) <shangsong2@foxmail.com>
Tue, 26 Aug 2025 03:02:29 +0000 (23:02 -0400)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 4 Sep 2025 14:21:41 +0000 (16:21 +0200)
If handler_address or mapped VA is NULL, the related buffer address and
VA can be ignored, so make acpi_parse_prmt() skip the current handler
in those cases.

Signed-off-by: Shang song (Lenovo) <shangsong2@foxmail.com>
Link: https://patch.msgid.link/20250826030229.834901-1-shangsong2@foxmail.com
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/prmt.c

index be033bbb126a444c196c2ad2e3f6db9a99a7abb1..6792d4385eee48306ce72093e190adadfa9e5a62 100644 (file)
@@ -150,15 +150,28 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
                th = &tm->handlers[cur_handler];
 
                guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
+
+               /*
+                * Print an error message if handler_address is NULL, the parse of VA also
+                * can be skipped.
+                */
+               if (unlikely(!handler_info->handler_address)) {
+                       pr_info("Skipping handler with NULL address for GUID: %pUL",
+                                       (guid_t *)handler_info->handler_guid);
+                       continue;
+               }
+
                th->handler_addr =
                        (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
                /*
-                * Print a warning message if handler_addr is zero which is not expected to
-                * ever happen.
+                * Print a warning message and skip the parse of VA if handler_addr is zero
+                * which is not expected to ever happen.
                 */
-               if (unlikely(!th->handler_addr))
+               if (unlikely(!th->handler_addr)) {
                        pr_warn("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx",
                                &th->guid, handler_info->handler_address);
+                       continue;
+               }
 
                th->static_data_buffer_addr =
                        efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);