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 53A8F2550D5; Mon, 23 Mar 2026 15:24:17 +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=1774279457; cv=none; b=gtVlCpo1xdNQ9oKNFL7AgmXNsJIr3jPyAK+MUnzt37YzJBoUEcHlQxEAQncr0mKiFLqd/2D7j/+kbCopbEAQmM4It4ZQzE/fK2gLJ5Zwf5QH+UmKXj2/q4fxk1s5KJVX7QxThIUc+qauauD6EQ3u61ygO61EPnsp6G+OQRQ9E58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774279457; c=relaxed/simple; bh=ABZlyuhe8URUxfla/POnHLiQIyluiDvLEWSoBRa3DjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s7Z3bEpS/gTVY+tQbLFulMUxFX+YJBV6KHzF5SEJS9o7PN5YuXQMqLlxfaFMs+FuKmimblFjm6bxumRZSn2WOElPNid7b5UWAcLL7rGouQuN4yCKacHBO4im9TENtoFpMdOjHvJBSUUyuhkmJDqNIvW34TIRS1fPa5mmaZYNTqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VGlBEyC4; 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="VGlBEyC4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB3EAC4CEF7; Mon, 23 Mar 2026 15:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774279457; bh=ABZlyuhe8URUxfla/POnHLiQIyluiDvLEWSoBRa3DjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGlBEyC4Cd2jrFpTCfFn5it0KmBIyLqu11Ax0nfw819J76+APlZbXpwe+EMBp4M1e 03pKANGxXjKmvzOUBAsMi8WsqfZAwk/dWdlms8xN8xx03qq9NzVBKmIScshso+WA9x m9KfmtyV/BeQdV4EWBgSYm0tSfHh/fbTwFS2/lv8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Bjorn Helgaas , Andy Shevchenko , Christian Marangi , Sasha Levin Subject: [PATCH 6.1 025/481] PCI: Use resource_set_range() that correctly sets ->end Date: Mon, 23 Mar 2026 14:40:07 +0100 Message-ID: <20260323134525.856436316@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@linuxfoundation.org> User-Agent: quilt/0.69 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 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilpo Järvinen [ Upstream commit 11721c45a8266a9d0c9684153d20e37159465f96 ] __pci_read_base() sets resource start and end addresses when resource is larger than 4G but pci_bus_addr_t or resource_size_t are not capable of representing 64-bit PCI addresses. This creates a problematic resource that has non-zero flags but the start and end addresses do not yield to resource size of 0 but 1. Replace custom resource addresses setup with resource_set_range() that correctly sets end address as -1 which results in resource_size() returning 0. For consistency, also use resource_set_range() in the other branch that does size based resource setup. Fixes: 23b13bc76f35 ("PCI: Fail safely if we can't handle BARs larger than 4GB") Link: https://lore.kernel.org/all/20251207215359.28895-1-ansuelsmth@gmail.com/T/#m990492684913c5a158ff0e5fc90697d8ad95351b Signed-off-by: Ilpo Järvinen Signed-off-by: Bjorn Helgaas Reviewed-by: Andy Shevchenko Cc: stable@vger.kernel.org Cc: Christian Marangi Link: https://patch.msgid.link/20251208145654.5294-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Sasha Levin --- drivers/pci/probe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8f99607e0a526..02f3fbe78c46f 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -264,8 +264,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, if ((sizeof(pci_bus_addr_t) < 8 || sizeof(resource_size_t) < 8) && sz64 > 0x100000000ULL) { res->flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED; - res->start = 0; - res->end = 0; + resource_set_range(res, 0, 0); pci_err(dev, "%s: can't handle BAR larger than 4GB (size %#010llx)\n", res_name, (unsigned long long)sz64); goto out; @@ -274,8 +273,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, if ((sizeof(pci_bus_addr_t) < 8) && l) { /* Above 32-bit boundary; try to reallocate */ res->flags |= IORESOURCE_UNSET; - res->start = 0; - res->end = sz64 - 1; + resource_set_range(res, 0, sz64); pci_info(dev, "%s: can't handle BAR above 4GB (bus address %#010llx)\n", res_name, (unsigned long long)l64); goto out; -- 2.51.0