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 3C71627FD44; Wed, 25 Feb 2026 01:47:24 +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=1771984044; cv=none; b=CXfNkBemgvkuTBoF+zcJm97HTJSvpOUI8PDPVdmtY4M0VTprN34ahm2fu8xitcW0NPUre7gjnqzzCmDLyVpA2PMbuxs/lgVH4iU6su/+iGHbt/GUv4LjHfGA92nfJnjIOpCrENowkISecTrbOqKq/FaKRX5uIjbuZ78ze0P5KQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771984044; c=relaxed/simple; bh=gmP+Fcy09/qdP0C5zJ+yLqG8N1T22nc38wqSF+7DfPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kicowfQO8H8mEhUohajyEXztg2e1Petr/ZHhiuyb4abf3b79CC5i9teXO2jqcWtkfJaMEFd++4srYGcAQpGKDQtOoAcUd1zD0bu08Sa4rpNpVmT5fu/KKL78+up3fGyQWYbH2ekG4xTPk7LsFm4o4fvcUV+BnQ1rml4lEZQAsnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hiCnTyZs; 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="hiCnTyZs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE11AC116D0; Wed, 25 Feb 2026 01:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1771984043; bh=gmP+Fcy09/qdP0C5zJ+yLqG8N1T22nc38wqSF+7DfPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiCnTyZsjWztbAHUg1xC1QcLYULNz5PtlG2UvnIPMg8Vp5Ti+d1nsEm16pqQrnERx HUUXKXPkvTsSq77qyEqJ0T91z7xll/4QAI+RFuSU5PEyEXGHq3WDFfalEI1Vac6kbw Ak5dh8pvf798IS3jU2T7mGTXnXvR1w65COycyqVY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Bjorn Helgaas , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.18 244/641] PCI/portdrv: Fix potential resource leak Date: Tue, 24 Feb 2026 17:19:30 -0800 Message-ID: <20260225012354.777695773@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260225012348.915798704@linuxfoundation.org> References: <20260225012348.915798704@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Uwe Kleine-König [ Upstream commit 01464a3fdf91c041a381d93a1b6fefbdb819a46f ] pcie_port_probe_service() unconditionally calls get_device() (unless it fails). So drop that reference also unconditionally as it's fine for a PCIe driver to not have a remove callback. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Uwe Kleine-König Signed-off-by: Bjorn Helgaas Reviewed-by: Ilpo Järvinen Reviewed-by: Jonathan Cameron Link: https://patch.msgid.link/e1c68c3b3f1af8427e98ca5e2c79f8bf0ebe2ce4.1764688034.git.u.kleine-koenig@baylibre.com Signed-off-by: Sasha Levin --- drivers/pci/pcie/portdrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c index 38a41ccf79b9a..a0991da482136 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c @@ -557,10 +557,10 @@ static int pcie_port_remove_service(struct device *dev) pciedev = to_pcie_device(dev); driver = to_service_driver(dev->driver); - if (driver && driver->remove) { + if (driver && driver->remove) driver->remove(pciedev); - put_device(dev); - } + + put_device(dev); return 0; } -- 2.51.0