get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 805929,
    "url": "http://patchwork.ozlabs.org/api/patches/805929/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/d5389d773e368a52ece886e43e355967c2af8fdf.1503671776.git.g.nault@alphalink.fr/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<d5389d773e368a52ece886e43e355967c2af8fdf.1503671776.git.g.nault@alphalink.fr>",
    "list_archive_url": null,
    "date": "2017-08-25T14:51:43",
    "name": "[net,4/5] l2tp: hold tunnel while handling genl TUNNEL_GET commands",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6cfa11f32d91ea3cdc83fbff4c1d7390c44b72cd",
    "submitter": {
        "id": 22975,
        "url": "http://patchwork.ozlabs.org/api/people/22975/?format=api",
        "name": "Guillaume Nault",
        "email": "g.nault@alphalink.fr"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/d5389d773e368a52ece886e43e355967c2af8fdf.1503671776.git.g.nault@alphalink.fr/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/805929/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/805929/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xf3yz0vk9z9sN5\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 26 Aug 2017 00:51:55 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1757293AbdHYOvx (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 25 Aug 2017 10:51:53 -0400",
            "from zimbra.alphalink.fr ([217.15.80.77]:53428 \"EHLO\n\tzimbra.alphalink.fr\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1755006AbdHYOvv (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 25 Aug 2017 10:51:51 -0400",
            "from localhost (localhost [127.0.0.1])\n\tby mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id\n\tBDC652B52097; Fri, 25 Aug 2017 16:51:50 +0200 (CEST)",
            "from zimbra.alphalink.fr ([127.0.0.1])\n\tby localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1])\n\t(amavisd-new, port 10032)\n\twith ESMTP id cXYO8zEnTkT5; Fri, 25 Aug 2017 16:51:44 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id\n\t534492B5214D; Fri, 25 Aug 2017 16:51:44 +0200 (CEST)",
            "from zimbra.alphalink.fr ([127.0.0.1])\n\tby localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1])\n\t(amavisd-new, port 10026)\n\twith ESMTP id IoTQv73yk6-y; Fri, 25 Aug 2017 16:51:44 +0200 (CEST)",
            "from c-dev-0.admin.alphalink.fr (94-84-15-217.reverse.alphalink.fr\n\t[217.15.84.94])\n\tby mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id\n\t298722B5206F; Fri, 25 Aug 2017 16:51:44 +0200 (CEST)",
            "by c-dev-0.admin.alphalink.fr (Postfix, from userid 1000)\n\tid 057636024C; Fri, 25 Aug 2017 16:51:43 +0200 (CEST)"
        ],
        "X-Virus-Scanned": "amavisd-new at mail-2-cbv2.admin.alphalink.fr",
        "Date": "Fri, 25 Aug 2017 16:51:43 +0200",
        "From": "Guillaume Nault <g.nault@alphalink.fr>",
        "To": "netdev@vger.kernel.org",
        "Cc": "James Chapman <jchapman@katalix.com>",
        "Subject": "[PATCH net 4/5] l2tp: hold tunnel while handling genl TUNNEL_GET\n\tcommands",
        "Message-ID": "<d5389d773e368a52ece886e43e355967c2af8fdf.1503671776.git.g.nault@alphalink.fr>",
        "References": "<cover.1503671776.git.g.nault@alphalink.fr>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "In-Reply-To": "<cover.1503671776.git.g.nault@alphalink.fr>",
        "X-Mutt-Fcc": "=Sent",
        "User-Agent": "NeoMutt/20170609 (1.8.3)",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Use l2tp_tunnel_get() instead of l2tp_tunnel_find() so that we get\na reference on the tunnel, preventing l2tp_tunnel_destruct() from\nfreeing it from under us.\n\nAlso move l2tp_tunnel_get() below nlmsg_new() so that we only take\nthe reference when needed.\n\nFixes: 309795f4bec2 (\"l2tp: Add netlink control API for L2TP\")\nSigned-off-by: Guillaume Nault <g.nault@alphalink.fr>\n---\n net/l2tp/l2tp_netlink.c | 27 +++++++++++++++------------\n 1 file changed, 15 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c\nindex d61e75b4e619..ae5170e26281 100644\n--- a/net/l2tp/l2tp_netlink.c\n+++ b/net/l2tp/l2tp_netlink.c\n@@ -444,34 +444,37 @@ static int l2tp_nl_cmd_tunnel_get(struct sk_buff *skb, struct genl_info *info)\n \n \tif (!info->attrs[L2TP_ATTR_CONN_ID]) {\n \t\tret = -EINVAL;\n-\t\tgoto out;\n+\t\tgoto err;\n \t}\n \n \ttunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);\n \n-\ttunnel = l2tp_tunnel_find(net, tunnel_id);\n-\tif (tunnel == NULL) {\n-\t\tret = -ENODEV;\n-\t\tgoto out;\n-\t}\n-\n \tmsg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);\n \tif (!msg) {\n \t\tret = -ENOMEM;\n-\t\tgoto out;\n+\t\tgoto err;\n+\t}\n+\n+\ttunnel = l2tp_tunnel_get(net, tunnel_id);\n+\tif (!tunnel) {\n+\t\tret = -ENODEV;\n+\t\tgoto err_nlmsg;\n \t}\n \n \tret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,\n \t\t\t\t  NLM_F_ACK, tunnel, L2TP_CMD_TUNNEL_GET);\n \tif (ret < 0)\n-\t\tgoto err_out;\n+\t\tgoto err_nlmsg_tunnel;\n+\n+\tl2tp_tunnel_dec_refcount(tunnel);\n \n \treturn genlmsg_unicast(net, msg, info->snd_portid);\n \n-err_out:\n+err_nlmsg_tunnel:\n+\tl2tp_tunnel_dec_refcount(tunnel);\n+err_nlmsg:\n \tnlmsg_free(msg);\n-\n-out:\n+err:\n \treturn ret;\n }\n \n",
    "prefixes": [
        "net",
        "4/5"
    ]
}