get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 515949,
    "url": "http://patchwork.ozlabs.org/api/patches/515949/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1441702364-46366-1-git-send-email-dvyukov@google.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1441702364-46366-1-git-send-email-dvyukov@google.com>",
    "list_archive_url": null,
    "date": "2015-09-08T08:52:44",
    "name": "e1000: fix data race between tx_ring->next_to_clean",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e0d7dfe568ee09bf59815a759b64c8e43131ebf5",
    "submitter": {
        "id": 9897,
        "url": "http://patchwork.ozlabs.org/api/people/9897/?format=api",
        "name": "Dmitry Vyukov",
        "email": "dvyukov@google.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1441702364-46366-1-git-send-email-dvyukov@google.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/515949/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/515949/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ozlabs.org (Postfix) with ESMTP id CE2B7140291\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 10 Sep 2015 03:32:55 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 29C8E86CE1;\n\tWed,  9 Sep 2015 17:32:55 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id zp24x4M6cqmj; Wed,  9 Sep 2015 17:32:54 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 350A18764C;\n\tWed,  9 Sep 2015 17:32:54 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 289B71C162E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue,  8 Sep 2015 08:52:52 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 22D02960D9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue,  8 Sep 2015 08:52:52 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id MFE56IUYo7tC for <intel-wired-lan@lists.osuosl.org>;\n\tTue,  8 Sep 2015 08:52:51 +0000 (UTC)",
            "from mail-wi0-f180.google.com (mail-wi0-f180.google.com\n\t[209.85.212.180])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 340FC960D5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue,  8 Sep 2015 08:52:51 +0000 (UTC)",
            "by wicge5 with SMTP id ge5so107556880wic.0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 08 Sep 2015 01:52:49 -0700 (PDT)",
            "from dvyukov-z840.muc.corp.google.com ([172.18.0.115])\n\tby smtp.gmail.com with ESMTPSA id\n\tgt4sm4531616wib.21.2015.09.08.01.52.48\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 08 Sep 2015 01:52:48 -0700 (PDT)",
            "by dvyukov-z840.muc.corp.google.com (Postfix, from userid 129372)\n\tid 6747FE1145; Tue,  8 Sep 2015 10:52:47 +0200 (CEST)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=OsUnf8fE; dkim-atps=neutral",
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20120113; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=GVzMB0/B8WAHYyEqUS1CeXnhoZlo/+kv3lVlGtdgvWY=;\n\tb=OsUnf8fEhUcYyxYKSnYtSSA/BcZcmq2xUTRzpVvOpBnpBZgvj8xCnY3ZbR92XCU/0h\n\tXr6DMz6SrIkFeYqYuGib9U9C8XJ11hHvwSWrIF4koHt5OALcrIPrnkFHg6Dia24rMpdI\n\tNJCG3Ctcu3iSbCarN3x07w7UPbf/JA5RDfu2Sg+HYsILpRlBRREsf9v6PbWGYME4oOoG\n\tTTf2CVBhD7TcbmWYRrG6YpLWQMqA1hnkhiQvhEMxuhkyNYA+gECQtMcABiYTAfyiUDdu\n\t6/cPMAXnQIFbPj+aaAsB3mhpyGgfw+dm1YwSZ2MBEggphrOvzEIjKu3Xpxd+D+pqdrrT\n\tzN3Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=GVzMB0/B8WAHYyEqUS1CeXnhoZlo/+kv3lVlGtdgvWY=;\n\tb=Inh2YeWPWGZg8JkPFju/gbZFrzZWrECcKw0wyiOZ87ch3uf3nUKZbb6Rw6cZO1LhdR\n\t/VMAOzW5vxPaJruhEjobLzoV10vEvBOHrZMaZnn4sajRqaIs59UpVebJTYisBfo1PlZi\n\t0mOCiprcNb3fZi05lJcGIoHZpriCsBB8FzJ+xD36DetIack5VTd2tRBEWWw2uKvpmoVA\n\tcJU4yHvlFSu7FMcBBst4ajlfl3SLeoiYbaQobVunClmruuOpHxo1OL20f6C7w2tKDfAV\n\tR4mxDkVpglOCQLq0yPAnrXqxyCzDZPPusNvvviJiI7NMUlNbElzl5pln+3XlGI0DCI++\n\tqN0Q==",
        "X-Gm-Message-State": "ALoCoQlFKH5NU6r1BIkIBmc61NcJsMK07/ja3To2dmfZZ7tJuA0kpKLCWkthVwrRJjtM1Rky3gCt",
        "X-Received": "by 10.194.238.202 with SMTP id\n\tvm10mr36589697wjc.96.1441702369378; \n\tTue, 08 Sep 2015 01:52:49 -0700 (PDT)",
        "From": "Dmitry Vyukov <dvyukov@google.com>",
        "To": "jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com,\n\tshannon.nelson@intel.com, carolyn.wyborny@intel.com,\n\tdonald.c.skidmore@intel.com, matthew.vick@intel.com,\n\tjohn.ronciak@intel.com, mitch.a.williams@intel.com",
        "Date": "Tue,  8 Sep 2015 10:52:44 +0200",
        "Message-Id": "<1441702364-46366-1-git-send-email-dvyukov@google.com>",
        "X-Mailer": "git-send-email 2.5.0.457.gab17608",
        "In-Reply-To": "<CACT4Y+bMLanwj1WTzw=eObMzUWfJvPz8q_QN9c49qZigFjAAzQ@mail.gmail.com>",
        "References": "<CACT4Y+bMLanwj1WTzw=eObMzUWfJvPz8q_QN9c49qZigFjAAzQ@mail.gmail.com>",
        "X-Mailman-Approved-At": "Wed, 09 Sep 2015 17:32:52 +0000",
        "Cc": "andreyknvl@google.com, kcc@google.com, glider@google.com,\n\tintel-wired-lan@lists.osuosl.org, ktsan@googlegroups.com,\n\tDmitry Vyukov <dvyukov@google.com>",
        "Subject": "[Intel-wired-lan] [PATCH] e1000: fix data race between\n\ttx_ring->next_to_clean",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "e1000_clean_tx_irq cleans buffers and sets tx_ring->next_to_clean,\nthen e1000_xmit_frame reuses the cleaned buffers. But there are no\nmemory barriers when buffers gets recycled, so the recycled buffers\ncan be corrupted.\n\nUse smp_store_release to update tx_ring->next_to_clean and\nsmp_load_acquire to read tx_ring->next_to_clean to properly\nhand off buffers from e1000_clean_tx_irq to e1000_xmit_frame.\n\nThe data race was found with KernelThreadSanitizer (KTSAN).\n\nSigned-off-by: Dmitry Vyukov <dvyukov@google.com>\n---\n drivers/net/ethernet/intel/e1000/e1000.h      | 7 +++++--\n drivers/net/ethernet/intel/e1000/e1000_main.c | 5 ++++-\n 2 files changed, 9 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/e1000/e1000.h b/drivers/net/ethernet/intel/e1000/e1000.h\nindex 6970710..98fe5a2 100644\n--- a/drivers/net/ethernet/intel/e1000/e1000.h\n+++ b/drivers/net/ethernet/intel/e1000/e1000.h\n@@ -213,8 +213,11 @@ struct e1000_rx_ring {\n };\n \n #define E1000_DESC_UNUSED(R)\t\t\t\t\t\t\\\n-\t((((R)->next_to_clean > (R)->next_to_use)\t\t\t\\\n-\t  ? 0 : (R)->count) + (R)->next_to_clean - (R)->next_to_use - 1)\n+({\t\t\t\t\t\t\t\t\t\\\n+\tunsigned int clean = smp_load_acquire(&(R)->next_to_clean);\t\\\n+\tunsigned int use = READ_ONCE((R)->next_to_use);\t\t\t\\\n+\t(clean > use ? 0 : (R)->count) + clean - use - 1;\t\t\\\n+})\n \n #define E1000_RX_DESC_EXT(R, i)\t\t\t\t\t\t\\\n \t(&(((union e1000_rx_desc_extended *)((R).desc))[i]))\ndiff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c\nindex 74dc150..97e38ce 100644\n--- a/drivers/net/ethernet/intel/e1000/e1000_main.c\n+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c\n@@ -3876,7 +3876,10 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,\n \t\teop_desc = E1000_TX_DESC(*tx_ring, eop);\n \t}\n \n-\ttx_ring->next_to_clean = i;\n+\t/* Synchronize with E1000_DESC_UNUSED called from e1000_xmit_frame,\n+\t * which will reuse the cleaned buffers.\n+\t */\n+\tsmp_store_release(&tx_ring->next_to_clean, i);\n \n \tnetdev_completed_queue(netdev, pkts_compl, bytes_compl);\n \n",
    "prefixes": []
}