From nobody Mon Jul 13 14:59:20 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 4gzQZJ4hDCz6lM9b for ; Mon, 13 Jul 2026 14:59:20 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gzQZJ3yxRz3pyw for ; Mon, 13 Jul 2026 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783954760; 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=kqc6qfmt0WFRyA/zFyvUNEcHs/JgOv35qhY+TeeSnmQ=; b=BdGayaIW32vX/ND9MQq3++3ZCdlcdgHdXAQlYZH1JXqDL+9Rm9PDKGl8O9eFoz0LNsFV3q kUmTqV2b6o5L3fv+VUgOBP4Xvmgb5iP+VqtFcDB00qkLghRFfz47dFfR7bTOcrIle5hmFJ duciXuTVg/givK1Eti3ie1Z7XZz3nQzigtd9Bd1tAytuiQlxufMCHR9xYyZrP1qelquxHm Nicx00XJ6/CDcnw25jD4bhIxSRO4gOJbT09HE31pmilXaqWcBExOZvwyx2ObgMuqHpcriB elxIdXefv7XEwNsYBFn/0LKANPK6xmrdFks4aRSmX1Jmi+F/jcSTvIGqHOAXew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783954760; a=rsa-sha256; cv=none; b=Q1VzsaXnDCqoxAglq3Xd+UiEBMZ/m233uHg/89vjY2L4vQriOW8EfusaLpF0C0cKqdMpIu Ua0rbmUYa7J0K5W5cicPcbvVzaDHjGW2hi9rFPEGrnRW6qaCnVvcXtAm8/2u+CExSuHd1F cGLQVqvU1DiKQIbhp4GYZJ1DVT3fZy6rqyT0NnJEnK/dhI8eIjRICpr/l7bdjMHIQTexhg 0IPQt7h7if3Ih45P7+UrgwlHuxMe/VxsEbA2kAEkkzvnTcSdGcRLGQlXxr1xoltLI35k+5 gPxXaeHoIsKy7kritqUA96dlEtMCG+8epkdmfbvcVWW4mZ4ssU3+sIDgTyOPfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783954760; 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=kqc6qfmt0WFRyA/zFyvUNEcHs/JgOv35qhY+TeeSnmQ=; b=nMOqvRV8P3pCWFSkRRj8RXNHul81CdpbbU4r7H2D0WqPmGgNqUg0pJe8/4Q1MYzjPX4LAC wQhSKjpRuLq+4r6obdhQo72LuMEupazHpQ4+erRUMHYxg6ku0ev0CHAy9Mmep+kgD4EPNL FZ+oGw44hV3w3RxEAM3N6ej3NOYaIEo/HAOXgoq0l/9PpzkP1cCsYQ7qhU5rfKCJYqga+o QYSjjrADtV9IRdoTfeeM43TuphoWCQvc8ZoRCSBGARQLHaNzIhL6bcAT0mOzfbI9h14W2a CLCg8vh26vW2e+vawZwvwwoh//6muRTGNqrPJgV4fbAm3aoZJ2xA90MGpikI4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gzQZJ2wLTz138B for ; Mon, 13 Jul 2026 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d6bf by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 13 Jul 2026 14:59:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: f9a37065b694 - main - LinuxKPI: fix lkpi_pci_get_device() reference counting on device List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9a37065b6948831f62a33fd0c68c96985b01a41 Auto-Submitted: auto-generated Date: Mon, 13 Jul 2026 14:59:20 +0000 Message-Id: <6a54fd48.3d6bf.54417bdf@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f9a37065b6948831f62a33fd0c68c96985b01a41 commit f9a37065b6948831f62a33fd0c68c96985b01a41 Author: Bjoern A. Zeeb AuthorDate: 2026-06-01 04:58:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-07-13 14:58:23 +0000 LinuxKPI: fix lkpi_pci_get_device() reference counting on device In case we are passed an "odev" (a device to start the search from), that device would have an extra reference. The best way to illustrate this is to look at for_each_pci_dev(), which will return one device after the other. Upon first return we return a pdev with a reference. That pdev is then passed in as odev on the next call. If we do not clear the reference it will be leaked. Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: 910cf345d0ee9 ("LinuxKPI: pci: implement ...") Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D57428 --- sys/compat/linuxkpi/common/src/linux_pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 477cb321ea9e..cdf7f00184ce 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -308,8 +308,9 @@ linux_pci_find(device_t dev, const struct pci_device_id **idp) struct pci_dev * lkpi_pci_get_device(uint32_t vendor, uint32_t device, struct pci_dev *odev) { - struct pci_dev *pdev, *found; + struct pci_dev *pdev, *found, *odev0; + odev0 = odev; found = NULL; spin_lock(&pci_lock); list_for_each_entry(pdev, &pci_devices, links) { @@ -328,6 +329,7 @@ lkpi_pci_get_device(uint32_t vendor, uint32_t device, struct pci_dev *odev) } pci_dev_get(found); spin_unlock(&pci_lock); + pci_dev_put(odev0); return (found); }