From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF17C1F755F; Tue, 17 Dec 2024 17:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734455626; cv=none; b=oR4jHDL78M8U6ABvd8WlKATM71pQjMd5NQzgFM5GvDdFWU8T2iXmnb8I6ydRQm7Rb0G+IGZ/CculjdyAO5VhiI991CNnZj4YNXwbKfd1EL5DQApDusf39pUC4OkfJulV6xgZbFxNItyVkRFqRL1I3m680wQX0HYMSDHQuATzXaY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734455626; c=relaxed/simple; bh=b0enR9fH8zJUjMaBo7WB8gPAFommh88ZmDv9WvZgky8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gX1EUXHyxRYELeIsGDag6QUXyDRjULlY7HR6ze5DPa20igT4bnVlFn550uv4r8q/bmlD6gjm7jDaSvjY+SPIIPUDcCP2t2hbbcDCH3SrEUD7Hgjsdex3a1PspX39Lr8m/I7sSkijl0cZjie4Cug6Cjp2K4vGgw6BaC3HW8Si564= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l+tyk5ea; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="l+tyk5ea" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E64A1C4CED3; Tue, 17 Dec 2024 17:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734455626; bh=b0enR9fH8zJUjMaBo7WB8gPAFommh88ZmDv9WvZgky8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+tyk5eadYzCCASPppQXbPQRVEZ82VdJOvdEaVRaJ0gSY1nyUPRGf6owiPOhBAhmc fZiKvO4r62FeEyzTw0JOQQ9oP5jn6NBvrYA1ksXJEM5oRiF+w1kdsWD7p8ZjGZydRb wICRfG+lGrkWRfdQ4E7LmYWap3rxNF7JUzKKlhOg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 30/51] ACPI: resource: Fix memory resource type union access Date: Tue, 17 Dec 2024 18:07:23 +0100 Message-ID: <20241217170521.521242829@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217170520.301972474@linuxfoundation.org> References: <20241217170520.301972474@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilpo Järvinen [ 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 Link: https://patch.msgid.link/20241202100614.20731-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 3c9f93981523..0433ab8ced0d 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); } -- 2.39.5