[PATCH 1/1] ACPI: PRM: Update address check for NULL handler

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

 



From: Shang song <shangsong2@xxxxxxxxxx>

According to section "4.1.2 PRM Handler Information Structure" in the
Platform Runtime Mechanism specification, the static data buffer and ACPI
parameter buffer may be NULL if not required. Therefore, when either
buffer is NULL, adding a check can prevent invalid virtual address
conversion attempts.

Without this patch, the following dmesg log could be misleading or
confusing to users:

  kernel: Failed to find VA for GUID: 7626C6AE-F973-429C-A91C-107D7BE298B0, PA: 0x0

Signed-off-by: Shang song <shangsong2@xxxxxxxxxx>
---
 drivers/acpi/prmt.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index e549914a636c..a97f0f3a6590 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -155,11 +155,21 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
 		th->handler_addr =
 			(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);

-		th->static_data_buffer_addr =
-			efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+		/*
+		 * Per section "4.1.2 PRM Handler Information Structure" in
+		 * spec "Platform Runtime Mechanism", the static data buffer
+		 * and acpi parameter buffer may be NULL if they are not
+		 * needed.
+		 */
+		if (handler_info->static_data_buffer_address) {
+			th->static_data_buffer_addr =
+				efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+		}

-		th->acpi_param_buffer_addr =
-			efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
+		if (handler_info->acpi_param_buffer_address) {
+			th->acpi_param_buffer_addr =
+				efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
+		}

 	} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));

--
2.43.5





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux