From nobody Wed Nov 18 07:42:09 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jTtpn3Y4mz6yxZt for ; Wed, 18 Nov 2026 07:42:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTtpn1jhBz4K2W for ; Wed, 18 Nov 2026 07:42:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794987729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vqlummsk0E6UkeooO4xGYGGSz5eoOMwKhxfQHRn+u7o=; b=IejSx8oGmLeEar81KNd+UEnX7oyFWPPQzC+IJ2h3ae9UKFR/6xQo4mvsjYi4qhiikpnXd1 aH/2i+h5WqFWngGgXDzXmGM8Jlp88gSgfztW3WHLQ6wOJbTgQ0pl4KePEZNB76WagCHW7h Cidzuuom1S+CjzziqggHSvWveopwGyJ2J/X7YHIu/zOsJisZ3J0nXdG0Pm8Pnj1lNGkeyH SP2MSTEs1rNKvu+M1mDSe1ZZaAZ3zdDgjwCpRn7M/Nmn0EUGHUqlFNdaZ+B9TuHscHM6Nt Hk7sVmUoSmzWRFMRlZ8/ZMjPRWxOu0QOTet207Qi/wAyv8ZSbve8Yp+snJ+7Hw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794987729; b=vQp5vXIpvkcgJF8e1JHbWR1kboNqzONNQ6vLCkMawZ51Ft1Wx1+mCaksB7k6+CR2g8Qk4m YR6cPeEdnOyFl9opGGz+BXQxeAyPWmtCi64z8F3lXMM0kBWe0v2Kl/t0fLuOYvxuRTNngG FMDBlnRsAOObnp48spjJj8cUmGh07FLKpsw39GvGChgPCCGjgb4WvBnsm0letXjvsm+fVy tNkPEpuRtkZyapNnRhz6Vxk0q1Cp5Ze3R0Lzhtpe7/557iTuc5j2wimHI56Ayw5fxE20Kp w5JZEidLBj+YjvnGfafz8vzYUZpDlefbjNOPxQ1H2jIshcP48WoO4VUnU7HcnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794987729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vqlummsk0E6UkeooO4xGYGGSz5eoOMwKhxfQHRn+u7o=; b=DkQcoPJUUXI8zHkzHSFZCA6xHl6xUX0EZcMJAsdkeKXcc3uQpLZMyb5LjajSqy/r4+pPO0 wzLTXoxDb1a+DLOVwmFCu7DZ8NcgBy+FXmU/wJVcgggbRfSGufXwLaF6uPe8i37uKYqV2k twWp5RNyzeWFlQHrPiIw7WNgY4Rf3Uo1o2r+bW8XuA2h8YPFPQ/W5W24KhBschrlsAO1/c BE1k9q+LQn0y3R0nN7ga8lJ2yLbBYuSCqdZ/DWlMKMBsGHXwnf9gAKbgaK2wJz6BxzIdlN 4bLN1ty4H/fMoB3mmK/JPKkuSJScSZRbnTAY0w1PWxb2lpK2bBhjG/RSO7bi6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTtpn1NSDz1K00 for ; Wed, 18 Nov 2026 07:42:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 149af by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 07:42:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: ee2f66a74d18 - main - linuxkpi: Release devres when the probe of a PCI driver fails List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee2f66a74d1850eea8deeae3cb2c9adfe08de49f Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 07:42:09 +0000 Message-Id: <6afd56d1.149af.2147c567@gitrepo.freebsd.org> The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=ee2f66a74d1850eea8deeae3cb2c9adfe08de49f commit ee2f66a74d1850eea8deeae3cb2c9adfe08de49f Author: Emmanuel Vadot AuthorDate: 2026-11-05 09:28:42 +0000 Commit: Emmanuel Vadot CommitDate: 2026-11-18 07:42:02 +0000 linuxkpi: Release devres when the probe of a PCI driver fails When the probe method of a driver fails, linux_pci_attach_device() only dropped its reference on the device. Like on detach (see the previous change), the devres actions are then not run if one of them holds a reference on the device, which is what devm_drm_dev_alloc() does through the drm_device. The device is never released, the drm_device is leaked with its minor, its managed memory and its debugfs entries: unloading the driver after a failed load (e.g. a missing firmware) printed "WARNING !xa_empty(&drm_minors_xa)" and leaked memory. Linux releases the devres resources of a device whose probe failed, so do the same. Differential Reivision: https://reviews.freebsd.org/D61223 --- sys/compat/linuxkpi/common/src/linux_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index a3e55c136b4a..365bd2c020b2 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -722,6 +722,14 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, return (0); out_err: + /* + * As on Linux when a probe fails, release the devres actions. Waiting + * for the last reference to go away is wrong: devres actions (e.g. the + * drm_dev_put() of devm_drm_dev_alloc()) may hold references on this + * very device, which then never gets released, nor does the object + * which holds the reference. + */ + lkpi_devres_release_free_list(&pdev->dev); put_device(&pdev->dev); return (-error); }