summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-12-02 12:06:13 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-19 18:11:30 +0100
commitae5fab215f9cab28e5fe5da1617fb3fad8ccd7d3 (patch)
tree87344498b4b3b61df86c949ada44d317b9261213
parent0d93441652732b3f4cd74fdf98e7fcde9992d6dd (diff)
downloadlinux-ae5fab215f9cab28e5fe5da1617fb3fad8ccd7d3.tar.gz
linux-ae5fab215f9cab28e5fe5da1617fb3fad8ccd7d3.tar.bz2
linux-ae5fab215f9cab28e5fe5da1617fb3fad8ccd7d3.zip
ACPI: resource: Fix memory resource type union access
[ Upstream commit 7899ca9f3bd2b008e9a7c41f2a9f1986052d7e96 ] In acpi_decode_space() addr->info.mem.caching is checked on main level for any resource type but addr->info.mem is part of union and thus valid only if the resource type is memory range. Move the check inside the preceeding switch/case to only execute it when the union is of correct type. Fixes: fcb29bbcd540 ("ACPI: Add prefetch decoding to the address space parser") Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://patch.msgid.link/20241202100614.20731-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/acpi/resource.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index d3d776d4fb5a..df598de0cb18 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -250,6 +250,9 @@ static bool acpi_decode_space(struct resource_win *win,
switch (addr->resource_type) {
case ACPI_MEMORY_RANGE:
acpi_dev_memresource_flags(res, len, wp);
+
+ if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
+ res->flags |= IORESOURCE_PREFETCH;
break;
case ACPI_IO_RANGE:
acpi_dev_ioresource_flags(res, len, iodec,
@@ -265,9 +268,6 @@ static bool acpi_decode_space(struct resource_win *win,
if (addr->producer_consumer == ACPI_PRODUCER)
res->flags |= IORESOURCE_WINDOW;
- if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
- res->flags |= IORESOURCE_PREFETCH;
-
return !(res->flags & IORESOURCE_DISABLED);
}