get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 805930,
    "url": "http://patchwork.ozlabs.org/api/patches/805930/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/b79825e8f68d83e0516af553cedde4c76fd7522c.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": "<b79825e8f68d83e0516af553cedde4c76fd7522c.1503671776.git.g.nault@alphalink.fr>",
    "list_archive_url": null,
    "date": "2017-08-25T14:51:46",
    "name": "[net,5/5] l2tp: hold tunnel used while creating sessions with netlink",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e4e188588e96611799d8e49bf698eb7ce64602f6",
    "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/b79825e8f68d83e0516af553cedde4c76fd7522c.1503671776.git.g.nault@alphalink.fr/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/805930/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/805930/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 3xf3z335tjz9sN5\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 26 Aug 2017 00:51:59 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1757302AbdHYOv6 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 25 Aug 2017 10:51:58 -0400",
            "from zimbra.alphalink.fr ([217.15.80.77]:53437 \"EHLO\n\tzimbra.alphalink.fr\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1755006AbdHYOvy (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 25 Aug 2017 10:51:54 -0400",
            "from localhost (localhost [127.0.0.1])\n\tby mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id\n\tA19712B52097; Fri, 25 Aug 2017 16:51:53 +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 G1l1accUb7ZK; Fri, 25 Aug 2017 16:51:47 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id\n\t168C32B5214C; Fri, 25 Aug 2017 16:51:47 +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 pziMoSn1hA3n; Fri, 25 Aug 2017 16:51:46 +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\tDE1E42B52097; Fri, 25 Aug 2017 16:51:46 +0200 (CEST)",
            "by c-dev-0.admin.alphalink.fr (Postfix, from userid 1000)\n\tid C13EF6024C; Fri, 25 Aug 2017 16:51:46 +0200 (CEST)"
        ],
        "X-Virus-Scanned": "amavisd-new at mail-2-cbv2.admin.alphalink.fr",
        "Date": "Fri, 25 Aug 2017 16:51:46 +0200",
        "From": "Guillaume Nault <g.nault@alphalink.fr>",
        "To": "netdev@vger.kernel.org",
        "Cc": "James Chapman <jchapman@katalix.com>",
        "Subject": "[PATCH net 5/5] l2tp: hold tunnel used while creating sessions with\n\tnetlink",
        "Message-ID": "<b79825e8f68d83e0516af553cedde4c76fd7522c.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() to retrieve tunnel, so that it can't go away on\nus. Otherwise l2tp_tunnel_destruct() might release the last reference\ncount concurrently, thus freeing the tunnel while we're using it.\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 | 21 ++++++++++++---------\n 1 file changed, 12 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c\nindex ae5170e26281..57427d430f10 100644\n--- a/net/l2tp/l2tp_netlink.c\n+++ b/net/l2tp/l2tp_netlink.c\n@@ -518,8 +518,9 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \t\tret = -EINVAL;\n \t\tgoto out;\n \t}\n+\n \ttunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);\n-\ttunnel = l2tp_tunnel_find(net, tunnel_id);\n+\ttunnel = l2tp_tunnel_get(net, tunnel_id);\n \tif (!tunnel) {\n \t\tret = -ENODEV;\n \t\tgoto out;\n@@ -527,24 +528,24 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \n \tif (!info->attrs[L2TP_ATTR_SESSION_ID]) {\n \t\tret = -EINVAL;\n-\t\tgoto out;\n+\t\tgoto out_tunnel;\n \t}\n \tsession_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);\n \n \tif (!info->attrs[L2TP_ATTR_PEER_SESSION_ID]) {\n \t\tret = -EINVAL;\n-\t\tgoto out;\n+\t\tgoto out_tunnel;\n \t}\n \tpeer_session_id = nla_get_u32(info->attrs[L2TP_ATTR_PEER_SESSION_ID]);\n \n \tif (!info->attrs[L2TP_ATTR_PW_TYPE]) {\n \t\tret = -EINVAL;\n-\t\tgoto out;\n+\t\tgoto out_tunnel;\n \t}\n \tcfg.pw_type = nla_get_u16(info->attrs[L2TP_ATTR_PW_TYPE]);\n \tif (cfg.pw_type >= __L2TP_PWTYPE_MAX) {\n \t\tret = -EINVAL;\n-\t\tgoto out;\n+\t\tgoto out_tunnel;\n \t}\n \n \tif (tunnel->version > 2) {\n@@ -566,7 +567,7 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \t\t\tu16 len = nla_len(info->attrs[L2TP_ATTR_COOKIE]);\n \t\t\tif (len > 8) {\n \t\t\t\tret = -EINVAL;\n-\t\t\t\tgoto out;\n+\t\t\t\tgoto out_tunnel;\n \t\t\t}\n \t\t\tcfg.cookie_len = len;\n \t\t\tmemcpy(&cfg.cookie[0], nla_data(info->attrs[L2TP_ATTR_COOKIE]), len);\n@@ -575,7 +576,7 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \t\t\tu16 len = nla_len(info->attrs[L2TP_ATTR_PEER_COOKIE]);\n \t\t\tif (len > 8) {\n \t\t\t\tret = -EINVAL;\n-\t\t\t\tgoto out;\n+\t\t\t\tgoto out_tunnel;\n \t\t\t}\n \t\t\tcfg.peer_cookie_len = len;\n \t\t\tmemcpy(&cfg.peer_cookie[0], nla_data(info->attrs[L2TP_ATTR_PEER_COOKIE]), len);\n@@ -618,7 +619,7 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \tif ((l2tp_nl_cmd_ops[cfg.pw_type] == NULL) ||\n \t    (l2tp_nl_cmd_ops[cfg.pw_type]->session_create == NULL)) {\n \t\tret = -EPROTONOSUPPORT;\n-\t\tgoto out;\n+\t\tgoto out_tunnel;\n \t}\n \n \t/* Check that pseudowire-specific params are present */\n@@ -628,7 +629,7 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \tcase L2TP_PWTYPE_ETH_VLAN:\n \t\tif (!info->attrs[L2TP_ATTR_VLAN_ID]) {\n \t\t\tret = -EINVAL;\n-\t\t\tgoto out;\n+\t\t\tgoto out_tunnel;\n \t\t}\n \t\tbreak;\n \tcase L2TP_PWTYPE_ETH:\n@@ -656,6 +657,8 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf\n \t\t}\n \t}\n \n+out_tunnel:\n+\tl2tp_tunnel_dec_refcount(tunnel);\n out:\n \treturn ret;\n }\n",
    "prefixes": [
        "net",
        "5/5"
    ]
}