From patchwork Fri May 3 19:23:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1931168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=qkaadJiX; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=4plJyvGC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-7051-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VWLLw5YZbz1yP2 for ; Sat, 4 May 2024 05:23:36 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BAC11281DFB for ; Fri, 3 May 2024 19:23:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01E6D158868; Fri, 3 May 2024 19:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qkaadJiX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4plJyvGC" X-Original-To: linux-pci@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9248F63CF; Fri, 3 May 2024 19:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764209; cv=none; b=u1lIy7K4D0z2ieVKQwwhwY11CGo9mZLY9rYnLYP8TwdrJg1ge/tTKXUBJ9fNweocqOLZJzNhGJpo7h0ZKM7JNIgcMGmKm2ftVAHvM8Bd+tW/zLSN3qTmMjfVUYSeA1dZRBKPX/KFu773BzeBBiSXnxVVCcpw16yDUyjelS/lazs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764209; c=relaxed/simple; bh=DaxfR4nd3a64EQUQw4NMPaAY0t4XypNnjDLYOANYiX4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DahePB4bENspD8oUgYnBcVi53r5p7JSGLRFbNMm9bs3f9j4MOnyetGp4/u8C/7v7dAVd//8kN7CsO4qCN4jE/b+E3JjFYVS6CmtP+Z0hKPXLb7JN7vVUZ9fazwBm5mBfmn0HfLLmPCRBGEmMANeh29dXQDl39b5LiTyJJtVf1bc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qkaadJiX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=4plJyvGC; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N5jIEdIgaqgrxTScZMNamJ/VXpKyySn2wZ02dAazQ0s=; b=qkaadJiXro9eyKM9NKF9MwCToGL7taF+8MDW9IJNbl7s9g86wSsxhnNnyaLos85G2f4F03 XEM9EqPGHsiChm4XX6NMa0TD8G58LDwkZtHqf5pK6P+s8ZzUisN/9GUjdrhpsnMsWqbRyT DR5JhUc213j9PF+ww3PpPFwwL4cHTR/Wdo1PkOOI0IQs5dzj1V8WHcuSeK/F8miPsOIEkl Op3s6L9RLEBm6lhK4cgT4xnSg5KjDfDFKDK/TSWACphS71lWwbFcoixcDJNjQmwEvCzkJh 9cftqoFthVUtKV+qhXmuYAqOWnhmh3EhL6wSRmELER5CQlAjsAGj6RInZgfGxQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N5jIEdIgaqgrxTScZMNamJ/VXpKyySn2wZ02dAazQ0s=; b=4plJyvGCzyfpMLlQEcJIOmsoajwdPs9a4JxmXMvg7I0l4o31erdjKmw0/wh6P35kcGlCJ4 /HIRlHM6JyJx7BDg== To: Bjorn Helgaas , Yinghai Lu , Greg Kroah-Hartman , Rajesh Shah , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nam Cao , stable@vger.kernel.org Subject: [PATCH 1/4] PCI: shpchp: bail out if pci_hp_add_bridge() fails Date: Fri, 3 May 2024 21:23:19 +0200 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If there is no bus number available for the downstream bus of the hot-plugged bridge, pci_hp_add_bridge() will fail. The driver proceeds regardless, and the kernel crashes. Abort if pci_hp_add_bridge() fails. Fixes: 7d01f70ac6f4 ("PCI: shpchp: use generic pci_hp_add_bridge()") Signed-off-by: Nam Cao Cc: Yinghai Lu Cc: --- drivers/pci/hotplug/shpchp_pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index 36db0c3c4ea6..2ac98bdc83d9 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c @@ -48,8 +48,13 @@ int shpchp_configure_device(struct slot *p_slot) } for_each_pci_bridge(dev, parent) { - if (PCI_SLOT(dev->devfn) == p_slot->device) - pci_hp_add_bridge(dev); + if (PCI_SLOT(dev->devfn) == p_slot->device) { + if (pci_hp_add_bridge(dev)) { + pci_stop_and_remove_bus_device(dev); + ret = -EINVAL; + goto out; + } + } } pci_assign_unassigned_bridge_resources(bridge); From patchwork Fri May 3 19:23:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1931171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=NeDOZAmj; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=VPxKixfJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-7054-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VWLMG48Zpz1yP2 for ; Sat, 4 May 2024 05:23:54 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 07C27286356 for ; Fri, 3 May 2024 19:23:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4591158D70; Fri, 3 May 2024 19:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NeDOZAmj"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VPxKixfJ" X-Original-To: linux-pci@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 924DC158207; Fri, 3 May 2024 19:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764210; cv=none; b=frS5MJtPpP8ZnZlZxq80rwRJzm/9kwpPWksju4S3oM+hJ8GS2KC21AiImekUbq6ItejYMDEGOAa0TAUEnjKqqFFfTeCBsRI6dO/4DmphJgm9FWhEV9BpIOZ2Ll7cS1XVVQijwN6zjp36fv/foMQC5vXwDZj6Ua52zPWAqp5CXkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764210; c=relaxed/simple; bh=EZgwArsC5As5LlGORe/CHEXCKSnJoGIS819EFQm9qjE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t9FwWkg2woVLE2gN8q7lnur/HjPyYvv97piG4AQ7rXRrUrtvL2LwSYw2J7DYd/qQPOjRuOPrOKyID0DZ+maTjjP544xw4h4WaL24iA46TMi7rXR2hyL63a5FU/IfP/ADV+/dYYMOqs3+XjgJA6j0bKJmK8LvPKxSXXErkFba8Q4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NeDOZAmj; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VPxKixfJ; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ufiKfNBkmRVUEcnLSYPA5RmeUW8wkmfMWjVab0qBmPM=; b=NeDOZAmjfeRDGVvGyg9BDMfEfamyyjqV+zIhaM7Dsd3ikXfinsEwSy/MKbLgEZUokEnOd1 LLm7pxP+TNLZhY9S2GdZgQzo8VDYDxFyJU61aFKVLr62+hDgVdYy0iJI6scgR5c24P1vme 3QXTY9G87RJfIleHy92yF0E6ZgVEnP1p9ST2sUN4VoPMh88DIFvKZMc1ID2D+eG1jGznYW NcpxWwAnS71sOByS+gGKP9BAGBne+ZbhqMjfetHmT09P6tHfUtoVsmukkd/Ju3vHFIy8f9 WmEwxfsEHkpaoD2FQvc1xVJWyY3hdGXhSa295By83UIni37ZoS89AHdL3Zhi8w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ufiKfNBkmRVUEcnLSYPA5RmeUW8wkmfMWjVab0qBmPM=; b=VPxKixfJXauOKep5gVzWa3vFvxUpna+EBpNuFRfMz3J5UEJOk2Z85ZuzT69wyJ3yPd5J+q bmqbgveUUtNq8wBw== To: Bjorn Helgaas , Yinghai Lu , Greg Kroah-Hartman , Rajesh Shah , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nam Cao , stable@vger.kernel.org Subject: [PATCH 2/4] PCI: pciehp: bail out if pci_hp_add_bridge() fails Date: Fri, 3 May 2024 21:23:20 +0200 Message-Id: <401e4044e05d52e4243ca7faa65d5ec8b19526b8.1714762038.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If there is no bus number available for the downstream bus of the hot-plugged bridge, pci_hp_add_bridge() will fail. The driver proceeds regardless, and the kernel crashes. Abort if pci_hp_add_bridge() fails. Fixes: 0eb3bcfd088e ("[PATCH] pciehp: allow bridged card hotplug") Signed-off-by: Nam Cao Cc: Rajesh Shah Cc: --- drivers/pci/hotplug/pciehp_pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index ad12515a4a12..faf4fcf2fbdf 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -58,8 +58,13 @@ int pciehp_configure_device(struct controller *ctrl) goto out; } - for_each_pci_bridge(dev, parent) - pci_hp_add_bridge(dev); + for_each_pci_bridge(dev, parent) { + if (pci_hp_add_bridge(dev)) { + pci_stop_and_remove_bus_device(dev); + ret = -EINVAL; + goto out; + } + } pci_assign_unassigned_bridge_resources(bridge); pcie_bus_configure_settings(parent); From patchwork Fri May 3 19:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1931169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=DBYVdxGW; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=0rqJFfKw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-pci+bounces-7052-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VWLM35zlMz1yP2 for ; Sat, 4 May 2024 05:23:43 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C950A1F257BA for ; Fri, 3 May 2024 19:23:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B977158874; Fri, 3 May 2024 19:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DBYVdxGW"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0rqJFfKw" X-Original-To: linux-pci@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9A7AE158844; Fri, 3 May 2024 19:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764210; cv=none; b=S/nkQf9IoduGsw2dwk4qGriVPDtk+XRKMqBYqCEWdfPOmy6UVuCmgmnRABMVlZvR7hc+P8PpLFDlLNiHTVFLsZ8mEoC36KmddK37E2U03wwvfc1bu6wwW6I69dZq7D+KVCVFFbf2zLFRGO6sLRmEQ+3LYwLNH+zbJDrzNSj6SjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764210; c=relaxed/simple; bh=JCwptbYruZjLqAtDL8TMWBeSIo+hkKvgWUdTdyJjyWw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U0gaKHnw7IJ8BbxtClb/payzvCnNbP3S0Rp4UoMTeRDWVSof64ggeVjuZz5hHQACUKIZIBQdntLDnYzNXAKE4eDZoQKjcl7/OAUs+LoiD7Al1aywZ2V88fKL3s9cenIyPhyRfhN7WX8DwzIiw4aMlMP4cShVovawORlKgeTjq90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DBYVdxGW; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0rqJFfKw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fc/r1OuWuEM/vzF5SITTG0OBh6zAtXYqIGqImW4XVPw=; b=DBYVdxGWNWaIJO+Zj8D+xlgfP+PZCeRi/A8087FnCrA13r3/+92+fF7V+NpSJKFUHaOGaH BWgrNrlCefUGHUTzi4i5inwViqOnTidI3G+sfqU5pLWxj1u9zo/VrWu6nCDHgeF337dAVJ j6DqbLPDu1l8thP9lQb3bVI5EEAHx/BmW+CMFo5dXR36/yWAlO004ClGbesJibw2y8vseK eOCKXo5XC8lAw27azVWaTtrlINiza0AhZ90wSPQjZwpy8fOfdo6+eqL8hRy4N9/c0VZ/DT AZIIVgDpR+JdvrCMmit7cyTT0aQxXWA0QU84EUDb/WrrPBNY+xLUDnVVUcXr+Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fc/r1OuWuEM/vzF5SITTG0OBh6zAtXYqIGqImW4XVPw=; b=0rqJFfKwH8JGJ97Gnij8Qy15fC1+b170+RIXO5lheI+z1l6YJMrj0wysu0NUdWtpfnfWZD xghuX+hoBYZ2q/DA== To: Bjorn Helgaas , Yinghai Lu , Greg Kroah-Hartman , Rajesh Shah , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nam Cao Subject: [PATCH 3/4] PCI: hotplug: document unchecked return value of pci_hp_add_bridge() Date: Fri, 3 May 2024 21:23:21 +0200 Message-Id: <16a2442ea6ee896987a44df3ed509e4cfde44475.1714762038.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some hotplug drivers do not check the returned value of pci_hp_add_bridge(). This may be probmatic if the driver proceed while pci_hp_add_bridge() fails. Signed-off-by: Nam Cao --- drivers/pci/hotplug/TODO | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index fdb8dd6ea24d..f0a1746c3c88 100644 --- a/drivers/pci/hotplug/TODO +++ b/drivers/pci/hotplug/TODO @@ -6,6 +6,8 @@ cpcihp: ->set_power callbacks in struct cpci_hp_controller_ops. Why were they introduced? Can they be removed from the struct? +* Returned code from pci_hp_add_bridge() is not checked. + cpqphp: * The driver spawns a kthread cpqhp_event_thread() which is woken by the @@ -16,6 +18,8 @@ cpqphp: * A large portion of cpqphp_ctrl.c and cpqphp_pci.c concerns resource management. Doesn't this duplicate functionality in the core? +* Returned code from pci_hp_add_bridge() is not checked. + ibmphp: * Implementations of hotplug_slot_ops callbacks such as get_adapter_present() @@ -43,6 +47,8 @@ ibmphp: * A large portion of ibmphp_res.c and ibmphp_pci.c concerns resource management. Doesn't this duplicate functionality in the core? +* Returned code from pci_hp_add_bridge() is not checked. + sgi_hotplug: * Several functions access the pci_slot member in struct hotplug_slot even From patchwork Fri May 3 19:23:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1931167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=x3OXucSj; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=egJquNjH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-pci+bounces-7050-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VWLLv0NbJz1yP2 for ; Sat, 4 May 2024 05:23:34 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 741BBB23F39 for ; Fri, 3 May 2024 19:23:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F37E9158849; Fri, 3 May 2024 19:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x3OXucSj"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="egJquNjH" X-Original-To: linux-pci@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9251F1586C2; Fri, 3 May 2024 19:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764209; cv=none; b=ZoXnrQq0pDyqA093M9mp9DXT2/1a/7aXw78DU4qxvCBiwMljoJX10u4+TKpEAjKpYIx5auTN8CYWyM34wCbS5qJ3pSDOqj+3zy3V/keOB84MMu8nojSQazXVLpuESTw7EMjtx7xdUfRYX4o53oUuk71a2WEeHKVugNq6+dJrXSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714764209; c=relaxed/simple; bh=fdxlFgTRTET902YIdVAvYcHjayn5OtsB/DYOOVfVLXQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eXSis/sbr9F/wS6D/0NNXJqE/AUtZca1wfVlbgqx0cVKJrA2slZdMrl+DY6JL2R9MnQxBuRWh6xhvoFvNUCPUvS5wJoMCT778LFRxwz0l2FK2NR+8DHwKXArLxEtL7yuuqHfwYnYHy79MM1MtrOzOZ+RC9AqhX2+TiM0yxQNaqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=x3OXucSj; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=egJquNjH; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+vorNXOmdM0ttzVHsmrotgcJ5HNUuVfx/TFGSwS7Dqc=; b=x3OXucSjFFabheDOKU6WBdJiz+USprJaSXBm9/8KBAsJOyZssUPzW/J1R2fjdN8mq0NKMC npiJmM9F/9Buqmr4+Bir32YMkNV2jT3KEZj2lN1S7Obxyfb2O7yb2ys1eVzpeSCXAyuw9P 90TVpPMKIcOGDYGHQTFBnnuO2g11U1ODP4wqBQHevPLLCtLXeamG9omuFbAYhzS+9Y1/as PrAcek9oR1sfv5LrWG4jUhUCMdZ3l9Ef6lWB1kmhAjz5YZvTIDlwTywiO0t68ZdhuWKCtl miHrweDKtyjGtE9fyIt/4IBac09z+X4hFKaWuHYgGysg7cntfoXbBoBkZoUzqg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714764207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+vorNXOmdM0ttzVHsmrotgcJ5HNUuVfx/TFGSwS7Dqc=; b=egJquNjH+SeW0ams1HGH9vOqn6vFQDAJ1fvDYlw4QPJurOUxtMy7nwKjSBTY0C2livlA1E 9tAQ0K+qaCJ+4nDQ== To: Bjorn Helgaas , Yinghai Lu , Greg Kroah-Hartman , Rajesh Shah , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nam Cao Subject: [PATCH 4/4] PCI: hotplug: remove TODO notes for sgi_hotplug Date: Fri, 3 May 2024 21:23:22 +0200 Message-Id: <26784ee39fbb3fbd0fe96508158d74419018e6ad.1714762038.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit c7532b601e77 ("PCI/hotplug: remove the sgi_hotplug driver") deleted the driver. Remove the remaining TODO notes as well. Signed-off-by: Nam Cao --- drivers/pci/hotplug/TODO | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index f0a1746c3c88..9d428b0ea524 100644 --- a/drivers/pci/hotplug/TODO +++ b/drivers/pci/hotplug/TODO @@ -49,14 +49,6 @@ ibmphp: * Returned code from pci_hp_add_bridge() is not checked. -sgi_hotplug: - -* Several functions access the pci_slot member in struct hotplug_slot even - though pci_hotplug.h declares it private. See sn_hp_destroy() for an - example. Either the pci_slot member should no longer be declared private - or sgi_hotplug should store a pointer to it in struct slot. Probably the - former. - shpchp: * There is only a single implementation of struct hpc_ops. Can the struct be