From nobody Wed Sep 30 00:53:33 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 4hvc3x26y5z6tLfc for ; Wed, 30 Sep 2026 00:53:33 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hvc3x1PCnz4WgN for ; Wed, 30 Sep 2026 00:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790729613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6s/egYNm7VwYj3ppmXfQhZlzvNu5bq3EMIoZCpY4KPU=; b=cyGKW5hmSw5n1mBNVqw110p9dOCJu3DI1w+H12QUawCaVysrWDljO8bltAxnFrRHktEKUn O9oSyZDhjs8z9cxkldk67gKVegA7+KKP8Pt8tv9DDoeBIK9f2CoEOPw+sinGFGyYJmKi6Y QBSxJsbD1MHr9opWthYuwHf4PXN2yJWrDatzHYwn5glKHKmm1yg+KORyLf5Wo5xzB2V8ag 7MNubxiDgGEWGyegm9yNAP6nfPOAfOM0+Ctd/k0Vm0hUpEUIAM9RicPt2hm6rEOYWAb6kQ lnxyAkyy7a+IOP9H0C262fqLIkgtRPiz79xpExE/bor5tVdCa6uv1LI/eTrLDA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790729613; b=oD2E3UWkdWD/QrLGc1oNvXE6pBYCmpwD3rMj8sFwPorR1QLFJo5P/serFh8Kf+jJbKMCt5 KZYAgcSd7Liy/oAcdPHkalfN+0ebd0P3GIXFC0DQ88cZ8T5IcSOEg9UQ2esNfPOinWaVtP C7ktoPR/w9C7RvlCXng6psrcW51kdF1wo1Pp3SclEpsy2YpI+vd7DVLAm3ltYumI1jB80n IgAHAjP4jkGAHL19+VwecgVphTTXoikDWRPq8ialfuRXs4x+MFhgL3dMfuSj4fdjhXr7Oq jcS7Ae0vlDUTVs87d7B/gubdnIG5H2pdPcdNECJYIJTImFfsiD2dg16xHlguKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790729613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6s/egYNm7VwYj3ppmXfQhZlzvNu5bq3EMIoZCpY4KPU=; b=NXjkbTnfcYPILdxlpuDs+8x83YKsKi6ateGQu7+pc1rZTM77Q/fBYb4k3cUEWuhtRuGApf t3us0JoA9H0HSIhUAXDHA+z6uTEh8DONrtvPnYr8lEu6nQqj+zgKE1etBvRzjnVoqhFwDf D/svExuIROU75LbZhC0PiNb6oaFofneEMnW3z7AUbHafUFWKp+9Y1FcidRA9JlQdm0ZyyH 2fZRa0fs1mzpT04aqOIjVz9wTbyf3Cjxjzahml5QQPQ6AUwrxc1j/0kq3gZPtN0Wrv6CF0 Ti7l1N0z4J1SE/2fIy5H2dOPCG0oIyb9VtY2cysQxI7x9t+gGnDSF4A7P5RYVQ== 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 4hvc3x08QtzMpX for ; Wed, 30 Sep 2026 00:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a125 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 30 Sep 2026 00:53:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Slava Shwartsman From: Konstantin Belousov Subject: git: c121ed33cde5 - stable/15 - linuxkpi: Fix double-cleanup in linux_pci_attach_device() error path 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: c121ed33cde56dd2bf019ffe22c47b12f134b8c9 Auto-Submitted: auto-generated Date: Wed, 30 Sep 2026 00:53:33 +0000 Message-Id: <6abc5d8d.1a125.6a830ea9@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c121ed33cde56dd2bf019ffe22c47b12f134b8c9 commit c121ed33cde56dd2bf019ffe22c47b12f134b8c9 Author: Slava Shwartsman AuthorDate: 2026-09-22 17:21:13 +0000 Commit: Konstantin Belousov CommitDate: 2026-09-30 00:52:16 +0000 linuxkpi: Fix double-cleanup in linux_pci_attach_device() error path (cherry picked from commit ac9c07a3e90888d69d0a524de520d4de8ae60de5) --- sys/compat/linuxkpi/common/src/linux_pci.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index b5aee166de2d..e75e5ba8086f 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -182,6 +182,8 @@ linux_pdev_dma_uninit(struct pci_dev *pdev) struct linux_dma_priv *priv; priv = pdev->dev.dma_priv; + if (priv == NULL) + return (0); if (priv->dmat) bus_dma_tag_destroy(priv->dmat); if (priv->dmat_coherent) @@ -480,6 +482,7 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) spin_lock_init(&pdev->dev.devres_lock); INIT_LIST_HEAD(&pdev->dev.devres_head); INIT_LIST_HEAD(&pdev->dev.irqents); + INIT_LIST_HEAD(&pdev->links); return (0); } @@ -698,7 +701,7 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, pdev->irq = pdev->dev.irq; error = linux_pdev_dma_init(pdev); if (error) - goto out_dma_init; + goto out_err; spin_lock(&pci_lock); list_add(&pdev->links, &pci_devices); @@ -713,7 +716,7 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, pbus = lkpinew_pci_dev(parent); if (pbus == NULL) { error = ENXIO; - goto out_dma_init; + goto out_err; } } pcie_find_root_port(pbus); @@ -728,19 +731,11 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, if (pdrv != NULL) { error = pdrv->probe(pdev, id); if (error) - goto out_probe; + goto out_err; } return (0); -/* XXX the cleanup does not match the allocation up there. */ -out_probe: - free(pdev->bus, M_DEVBUF); - spin_lock_destroy(&pdev->pcie_cap_lock); - linux_pdev_dma_uninit(pdev); -out_dma_init: - spin_lock(&pci_lock); - list_del(&pdev->links); - spin_unlock(&pci_lock); +out_err: put_device(&pdev->dev); return (-error); }