Skip to content

Commit a83e138

Browse files
RajuRangojurafaeljw
authored andcommitted
ACPICA: Revert "ACPICA: avoid Info: mapping multiple BARs. Your kernel is fine."
Undo the modifications made in commit d410ee5 ("ACPICA: avoid "Info: mapping multiple BARs. Your kernel is fine.""). The initial purpose of this commit was to stop memory mappings for operation regions from overlapping page boundaries, as it can trigger warnings if different page attributes are present. However, it was found that when this situation arises, mapping continues until the boundary's end, but there is still an attempt to read/write the entire length of the map, leading to a NULL pointer deference. For example, if a four-byte mapping request is made but only one byte is mapped because it hits the current page boundary's end, a four-byte read/write attempt is still made, resulting in a NULL pointer deference. Instead, map the entire length, as the ACPI specification does not mandate that it must be within the same page boundary. It is permissible for it to be mapped across different regions. Link: acpica/acpica#954 Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218849 Fixes: d410ee5 ("ACPICA: avoid "Info: mapping multiple BARs. Your kernel is fine."") Co-developed-by: Sanath S <[email protected]> Signed-off-by: Sanath S <[email protected]> Signed-off-by: Raju Rangoju <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 6ba59ff commit a83e138

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

drivers/acpi/acpica/exregion.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ acpi_ex_system_memory_space_handler(u32 function,
4444
struct acpi_mem_mapping *mm = mem_info->cur_mm;
4545
u32 length;
4646
acpi_size map_length;
47-
acpi_size page_boundary_map_length;
4847
#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
4948
u32 remainder;
5049
#endif
@@ -138,26 +137,8 @@ acpi_ex_system_memory_space_handler(u32 function,
138137
map_length = (acpi_size)
139138
((mem_info->address + mem_info->length) - address);
140139

141-
/*
142-
* If mapping the entire remaining portion of the region will cross
143-
* a page boundary, just map up to the page boundary, do not cross.
144-
* On some systems, crossing a page boundary while mapping regions
145-
* can cause warnings if the pages have different attributes
146-
* due to resource management.
147-
*
148-
* This has the added benefit of constraining a single mapping to
149-
* one page, which is similar to the original code that used a 4k
150-
* maximum window.
151-
*/
152-
page_boundary_map_length = (acpi_size)
153-
(ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address);
154-
if (page_boundary_map_length == 0) {
155-
page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE;
156-
}
157-
158-
if (map_length > page_boundary_map_length) {
159-
map_length = page_boundary_map_length;
160-
}
140+
if (map_length > ACPI_DEFAULT_PAGE_SIZE)
141+
map_length = ACPI_DEFAULT_PAGE_SIZE;
161142

162143
/* Create a new mapping starting at the address given */
163144

0 commit comments

Comments
 (0)