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 5DEF13FDC00; Wed, 20 May 2026 18:45:30 +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=1779302731; cv=none; b=X1DzRgJBXwRLEmWcCyKTqvM3hGC5ve2DdpE4IfmR1TMCpZssqomMVWG8mewuWgPPbvzEqwZBZMKsGF7gq/2Uj76QOApcyFkiVbSG1m8w8Lw/Bpj/b8t/ZunU5EvvlnPAMxtqz/qZKtwKb1NrRR3A8Kbxd0hkL2PrbdbW9JN7SOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302731; c=relaxed/simple; bh=+9YcZJea2W+9Rbs4PYU9s6I/seQESznPIJdanjEUDiE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PgC8rv2n5Mco8p0J4cuQX/AxfkE6+II72uIC9Hyud/t9l00tyg8QZALAS1QlN5pyRPIEb+/H3uZ1uXB87l1g7mLxXCHuJCGVaGexZT7tWn6LygeYCyUtFzUObSE5b3csYgh1PUWq4Y9vYMSPqLvNxh2fCXL1rsmmDBs9o8Drkgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OtLYl+EE; 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="OtLYl+EE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA7071F000E9; Wed, 20 May 2026 18:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779302730; bh=J0uronvOI1w9kxUHKGPBUI03epUmaGC/HO4MNXDgdjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OtLYl+EEa/l17ERu0MX+70lzkqeDlQouwtCJyHlflsrNMtTmZYp0PAB2VctmotM59 dzQIpqboaqFruZc6ULRwEeQRA3UGPxv/WsHd/HFGLRn6XOaztG8pJTMvxZt5TlMUfn BI9Mfdyzq2PRk9S35N19NRTOFM8l4Rqgt/TBIyI0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Myeonghun Pak , Ijae Kim , Taegyu Kim , Yuho Choi , Thomas Zimmermann , Sasha Levin Subject: [PATCH 6.6 377/508] drm/sysfb: ofdrm: fix PCI device reference leaks Date: Wed, 20 May 2026 18:23:20 +0200 Message-ID: <20260520162106.791230846@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@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-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuho Choi [ Upstream commit 4aa8110000b0d215deef8eed283565dd0c1def88 ] display_get_pci_dev_of() gets a referenced PCI device via pci_get_device(). Drop that reference when pci_enable_device() fails and release it during the managed teardown path after pci_disable_device(). Without that, ofdrm leaks the pci_dev reference on both the error path and the normal cleanup path. Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers") Co-developed-by: Myeonghun Pak Signed-off-by: Myeonghun Pak Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Co-developed-by: Taegyu Kim Signed-off-by: Taegyu Kim Signed-off-by: Yuho Choi Reviewed-by: Thomas Zimmermann Signed-off-by: Thomas Zimmermann Link: https://patch.msgid.link/20260420002513.216-1-dbgh9129@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/tiny/ofdrm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/ofdrm.c b/drivers/gpu/drm/tiny/ofdrm.c index 2d999a0facdee..fe2d3b7c61258 100644 --- a/drivers/gpu/drm/tiny/ofdrm.c +++ b/drivers/gpu/drm/tiny/ofdrm.c @@ -351,6 +351,7 @@ static void ofdrm_pci_release(void *data) struct pci_dev *pcidev = data; pci_disable_device(pcidev); + pci_dev_put(pcidev); } static int ofdrm_device_init_pci(struct ofdrm_device *odev) @@ -376,6 +377,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev) if (ret) { drm_err(dev, "pci_enable_device(%s) failed: %d\n", dev_name(&pcidev->dev), ret); + pci_dev_put(pcidev); return ret; } ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev); -- 2.53.0