get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2230765/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2230765,
    "url": "http://patchwork.ozlabs.org/api/patches/2230765/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260430003542.455198-1-kwilczynski@kernel.org/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260430003542.455198-1-kwilczynski@kernel.org>",
    "list_archive_url": null,
    "date": "2026-04-30T00:35:42",
    "name": "PCI/proc: Fix race between pci_proc_init() and pci_bus_add_device()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "94ffe2c2ace04f6f787ce7cc2808fe4cff42827b",
    "submitter": {
        "id": 86709,
        "url": "http://patchwork.ozlabs.org/api/people/86709/?format=api",
        "name": "Krzysztof Wilczyński",
        "email": "kwilczynski@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260430003542.455198-1-kwilczynski@kernel.org/mbox/",
    "series": [
        {
            "id": 502177,
            "url": "http://patchwork.ozlabs.org/api/series/502177/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=502177",
            "date": "2026-04-30T00:35:42",
            "name": "PCI/proc: Fix race between pci_proc_init() and pci_bus_add_device()",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502177/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2230765/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230765/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-53435-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-pci@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=DPy0PUVJ;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53435-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"DPy0PUVJ\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5Zw525X8z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 10:35:49 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 79FED3005D31\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 00:35:46 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D032E2E63C;\n\tThu, 30 Apr 2026 00:35:45 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id ACBB240DFDB\n\tfor <linux-pci@vger.kernel.org>; Thu, 30 Apr 2026 00:35:45 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 0A63CC19425;\n\tThu, 30 Apr 2026 00:35:43 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777509345; cv=none;\n b=Xs3pTLdWioGssgFMqhQyFJ6g+O6PbJx+42Fvn4BpmsdyrGJaFOFg6oB7jEfeMZcyD1Wje2wjnpFLHLpljLtgZjlJVyhvVld39fu9dFZv0lJFS/4kq+A9V9VeSmP4o6Mb8tAsfgXybrFmWwF5BAu5anqnrQNaA1ovR9rmEyAXCbo=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777509345; c=relaxed/simple;\n\tbh=tHRXmR6VQcmnd19CwjoHzYakRyuHtTseVwT528iMuKU=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type;\n b=j4o0MIe8ta8R1O18AxkDwn2A1gpJ5o1G6/atbI98kEsm2tEbwkcMqe48li43aM3Ozsb4q2HLxmrk9obeqfMJNHWD/U1B8mpFqJkLSHK79RATjkPQP/tY5qAFQ2oli0DimTxW4dMyvd4qsjrhGHYdRQLWJDWqAuOvZZ8OaRlhQlw=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=DPy0PUVJ; arc=none smtp.client-ip=10.30.226.201",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777509345;\n\tbh=tHRXmR6VQcmnd19CwjoHzYakRyuHtTseVwT528iMuKU=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=DPy0PUVJW83UpfZBqsi9lPec3HuIW0irun3ai/DHBzijhJESyj4qF+RXyeNgIBOAA\n\t EFja8nDGuyRbaZhUXqE1id/anUIloU4f7hRqmjIBsotYl05NwkFbMEI4MwVNt+Qxoo\n\t CfWmZI+meDAB/SjVHKHiur9bxDKALzXzK7abQz/y7L19RzH7Mzm+Nh4rHNRWm9poV8\n\t nc3aWfvDTgkeI3fohtYVcBztol4mbfcaY84nPW2p9SVh+NMaI6f1GREfoWc7nw1sGZ\n\t DOAH11qdGwLA7E2i5QP0IKlSnekSO7xqmLCKbduwN3xTJO5vC0793/JViF+txU3xAK\n\t 7hCsmL3I37Qsw==",
        "From": "=?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>",
        "To": "Bjorn Helgaas <bhelgaas@google.com>",
        "Cc": "Bjorn Helgaas <helgaas@kernel.org>,\n Manivannan Sadhasivam <mani@kernel.org>,\n Lorenzo Pieralisi <lpieralisi@kernel.org>,\n =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>,\n Lukas Wunner <lukas@wunner.de>, Shuan He <heshuan@bytedance.com>,\n linux-pci@vger.kernel.org",
        "Subject": "[PATCH] PCI/proc: Fix race between pci_proc_init() and\n pci_bus_add_device()",
        "Date": "Thu, 30 Apr 2026 00:35:42 +0000",
        "Message-ID": "<20260430003542.455198-1-kwilczynski@kernel.org>",
        "X-Mailer": "git-send-email 2.54.0",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-pci@vger.kernel.org",
        "List-Id": "<linux-pci.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "pci_proc_attach_device() creates procfs entries for PCI devices and is\ncalled from pci_bus_add_device().  It returns early if proc_initialized\nis not yet set.\n\nOn x86 with ACPI, PCI enumeration occurs at subsys_initcall, before\npci_proc_init() sets proc_initialized at device_initcall.  The\nfor_each_pci_dev() loop in pci_proc_init() creates procfs entries for\nthese already-enumerated devices.  This loop runs without holding any\nlock.\n\nOn ARM64 with devicetree, PCI host bridges probe at device_initcall.\nWith async probing enabled, pci_bus_add_device() can run concurrently\nwith pci_proc_init(), and both may call pci_proc_attach_device() for\nthe same device, leading to duplicate proc_create_data() calls.\n\nThus, wrap the for_each_pci_dev() loop with pci_lock_rescan_remove() to\nserialise against concurrent PCI bus operations.  Add an early return in\npci_proc_attach_device() when dev->procent is already set, making the\nfunction idempotent and symmetric with pci_proc_detach_device() which\nclears this field.\n\nWhile at it, update code to match preferred style and help with\nreadability.\n\nSigned-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>\n---\n drivers/pci/proc.c | 10 +++++++++-\n 1 file changed, 9 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c\nindex ce36e35681e8..9326f235bc58 100644\n--- a/drivers/pci/proc.c\n+++ b/drivers/pci/proc.c\n@@ -425,6 +425,9 @@ int pci_proc_attach_device(struct pci_dev *dev)\n \tif (!proc_initialized)\n \t\treturn -EACCES;\n \n+\tif (dev->procent)\n+\t\treturn 0;\n+\n \tif (!bus->procdir) {\n \t\tif (pci_proc_domain(bus)) {\n \t\t\tsprintf(name, \"%04x:%02x\", pci_domain_nr(bus),\n@@ -464,12 +467,17 @@ int pci_proc_detach_bus(struct pci_bus *bus)\n static int __init pci_proc_init(void)\n {\n \tstruct pci_dev *dev = NULL;\n+\n \tproc_bus_pci_dir = proc_mkdir(\"bus/pci\", NULL);\n \tproc_create_seq(\"devices\", 0, proc_bus_pci_dir,\n-\t\t    &proc_bus_pci_devices_op);\n+\t\t\t&proc_bus_pci_devices_op);\n+\n \tproc_initialized = 1;\n+\n+\tpci_lock_rescan_remove();\n \tfor_each_pci_dev(dev)\n \t\tpci_proc_attach_device(dev);\n+\tpci_unlock_rescan_remove();\n \n \treturn 0;\n }\n",
    "prefixes": []
}