From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 222A151A747; Wed, 30 Sep 2026 17:33:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789631; cv=none; b=oXsJjKdoMy5XoLRqj2idNpktjAcXSyW4Cs5LK1PFBwUALKPBgPQlwJkaTttFv6PJPJBU+1+rSZUw/kLAAR411Tc6u8Ud98iPsA0VH5aRj5ay7k6N5K8rtqgcLjXhUuJfFi0tL6VeWHEeXxztVfX9y686voVYZEAURDK45As2iEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789631; c=relaxed/simple; bh=RxvX9vtUN/0rP5NJWr4sxpCbJy1tVAoYaPD347wxwp8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J8SU6ZaVyyiepFYMA/cfBNHaVqcuvNEZz4ec+DiHsvHjC+2W0+NA+Zef6dV5SSkAYJdzPhVjNkWVzmt+vEdHLd+QwXdNuGz1nBp680U2y0xqlzboqGh0hvj013ueMv2kmUGLyT+C89zzA17YGHj1fStnmU6xY+dByPHR+AB4zYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=STLW3Z7S; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="STLW3Z7S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D7B91F000FF; Wed, 30 Sep 2026 17:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790789630; bh=adL329oC+vJeqgGbyrSrKkv4rAFsCLlvOhnSJwi4Ukg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=STLW3Z7SIB04mJ8ON6hFvEQEcebgKFKBFM7HfYtVYKMSur0rRpduom9QGBOp6iP5n ppbV/S4kj21gc7ZXQw4Ld/557a8FtQHXjl/K5P4J6toneZIaG1s/+f0H8Iu3mTMgME THk/XgJ0wCE6WcPAzNpQQw3moeJCfFbqW8/fj398= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Angel J , Bjorn Helgaas Subject: [PATCH 6.12 500/877] PCI: of_property: Omit bus properties without a subordinate bus Date: Wed, 30 Sep 2026 17:23:31 +0200 Message-ID: <20260930152425.452722014@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Angel J commit 8805840aad73df7146778be243a196d48b4f6430 upstream. A bridge (a device with a Type 1 header) may not have a secondary bus allocated (pdev->subordinate), e.g., if there are no available bus numbers or the bridge secondary/subordinate bus numbers are not writable. The dynamic OF helpers of_pci_prop_bus_range() and of_pci_prop_intr_map() dereference pdev->subordinate without checking it. When CONFIG_PCI_DYNAMIC_OF_NODES is enabled, this can cause a NULL pointer dereference and early boot hang. Generate 'bus-range' and 'interrupt-map' properties only when a subordinate bus exists. Keep the node and its remaining properties for bridges without one. The problem was latent since 407d1a51921e ("PCI: Create device tree node for bridge"), but wasn't reachable until 1f340724419e ("PCI: of: Create device tree PCI host bridge node"), which appeared in v6.15. Before 1f340724419e, of_pci_make_dev_node() returned early because the parent OF node was missing. Fixes: 407d1a51921e ("PCI: Create device tree node for bridge") Signed-off-by: Angel J [bhelgaas: move pdev->subordinate test to callees, commit log] Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v6.6+ Link: https://patch.msgid.link/20260918195540.GA1187209@bhelgaas Signed-off-by: Greg Kroah-Hartman --- drivers/pci/of_property.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -91,9 +91,13 @@ static int of_pci_prop_bus_range(struct struct of_changeset *ocs, struct device_node *np) { - u32 bus_range[] = { pdev->subordinate->busn_res.start, - pdev->subordinate->busn_res.end }; + u32 bus_range[2]; + if (!pdev->subordinate) + return 0; + + bus_range[0] = pdev->subordinate->busn_res.start; + bus_range[1] = pdev->subordinate->busn_res.end; return of_changeset_add_prop_u32_array(ocs, np, "bus-range", bus_range, ARRAY_SIZE(bus_range)); } @@ -216,6 +220,9 @@ static int of_pci_prop_intr_map(struct p int ret; u8 pin; + if (!pdev->subordinate) + return 0; + pnode = pci_device_to_OF_node(pdev->bus->self); if (!pnode) pnode = pci_bus_to_OF_node(pdev->bus);