get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 980262,
    "url": "http://patchwork.ozlabs.org/api/patches/980262/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20181008031644.15989-23-dsahern@kernel.org/",
    "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": "<20181008031644.15989-23-dsahern@kernel.org>",
    "list_archive_url": null,
    "date": "2018-10-08T03:16:43",
    "name": "[v2,net-next,22/23] rtnetlink: Move input checking for rtnl_fdb_dump to helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4d6bde9e7d6a4b9488757becc62a4607734c841e",
    "submitter": {
        "id": 74101,
        "url": "http://patchwork.ozlabs.org/api/people/74101/?format=api",
        "name": "David Ahern",
        "email": "dsahern@kernel.org"
    },
    "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/20181008031644.15989-23-dsahern@kernel.org/mbox/",
    "series": [
        {
            "id": 69470,
            "url": "http://patchwork.ozlabs.org/api/series/69470/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=69470",
            "date": "2018-10-08T03:16:21",
            "name": "rtnetlink: Add support for rigid checking of data in dump request",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/69470/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/980262/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/980262/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming-netdev@ozlabs.org",
        "Delivered-To": "patchwork-incoming-netdev@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>)",
            "ozlabs.org;\n\tdmarc=pass (p=none dis=none) header.from=kernel.org",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=kernel.org header.i=@kernel.org\n\theader.b=\"DxTEMb/3\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 42T5BM2fDlz9sCV\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tMon,  8 Oct 2018 14:16:59 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1727080AbeJHK00 (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tMon, 8 Oct 2018 06:26:26 -0400",
            "from mail.kernel.org ([198.145.29.99]:42664 \"EHLO mail.kernel.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1726969AbeJHK0X (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 8 Oct 2018 06:26:23 -0400",
            "from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com\n\t[216.129.126.126])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby mail.kernel.org (Postfix) with ESMTPSA id D521B2087D;\n\tMon,  8 Oct 2018 03:16:52 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=default; t=1538968613;\n\tbh=JlqcFyR1iPkHvYUWY8sO4fAK4Q5YLeRWQGC8ipu20IY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DxTEMb/3k1TWcSrmpct08GHDX7nyXJ9H2qL2XFWaHUDf2YBbWXZc4ueuRyGSpAYkY\n\tCQeGd77Z8weWJzwJX8LXcxuAU4LfPE8TjL0EfQaM0yN96FAoly4Es+IJDW2mnm2SFS\n\tPpR8UVOBQhQ+tmuY1af3ANX0CFBKVCJFuIAECtCw=",
        "From": "David Ahern <dsahern@kernel.org>",
        "To": "netdev@vger.kernel.org, davem@davemloft.net",
        "Cc": "christian@brauner.io, jbenc@redhat.com, stephen@networkplumber.org,\n\tDavid Ahern <dsahern@gmail.com>",
        "Subject": "[PATCH v2 net-next 22/23] rtnetlink: Move input checking for\n\trtnl_fdb_dump to helper",
        "Date": "Sun,  7 Oct 2018 20:16:43 -0700",
        "Message-Id": "<20181008031644.15989-23-dsahern@kernel.org>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20181008031644.15989-1-dsahern@kernel.org>",
        "References": "<20181008031644.15989-1-dsahern@kernel.org>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "From: David Ahern <dsahern@gmail.com>\n\nMove the existing input checking for rtnl_fdb_dump into a helper,\nvalid_fdb_dump_legacy. This function will retain the current\nlogic that works around the 2 headers that userspace has been\nallowed to send up to this point.\n\nSigned-off-by: David Ahern <dsahern@gmail.com>\n---\n net/core/rtnetlink.c | 53 ++++++++++++++++++++++++++++++++--------------------\n 1 file changed, 33 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c\nindex f6d2609cfa9f..c7509c789fb6 100644\n--- a/net/core/rtnetlink.c\n+++ b/net/core/rtnetlink.c\n@@ -3799,22 +3799,13 @@ int ndo_dflt_fdb_dump(struct sk_buff *skb,\n }\n EXPORT_SYMBOL(ndo_dflt_fdb_dump);\n \n-static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)\n+static int valid_fdb_dump_legacy(const struct nlmsghdr *nlh,\n+\t\t\t\t int *br_idx, int *brport_idx,\n+\t\t\t\t struct netlink_ext_ack *extack)\n {\n-\tstruct net_device *dev;\n+\tstruct ifinfomsg *ifm = nlmsg_data(nlh);\n \tstruct nlattr *tb[IFLA_MAX+1];\n-\tstruct net_device *br_dev = NULL;\n-\tconst struct net_device_ops *ops = NULL;\n-\tconst struct net_device_ops *cops = NULL;\n-\tstruct ifinfomsg *ifm = nlmsg_data(cb->nlh);\n-\tstruct net *net = sock_net(skb->sk);\n-\tstruct hlist_head *head;\n-\tint brport_idx = 0;\n-\tint br_idx = 0;\n-\tint h, s_h;\n-\tint idx = 0, s_idx;\n-\tint err = 0;\n-\tint fidx = 0;\n+\tint err;\n \n \t/* A hack to preserve kernel<->userspace interface.\n \t * Before Linux v4.12 this code accepted ndmsg since iproute2 v3.3.0.\n@@ -3823,20 +3814,42 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)\n \t * Fortunately these sizes don't conflict with the size of ifinfomsg\n \t * with an optional attribute.\n \t */\n-\tif (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) &&\n-\t    (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) +\n+\tif (nlmsg_len(nlh) != sizeof(struct ndmsg) &&\n+\t    (nlmsg_len(nlh) != sizeof(struct ndmsg) +\n \t     nla_attr_size(sizeof(u32)))) {\n-\t\terr = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,\n-\t\t\t\t  IFLA_MAX, ifla_policy, cb->extack);\n+\t\terr = nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb, IFLA_MAX,\n+\t\t\t\t  ifla_policy, extack);\n \t\tif (err < 0) {\n \t\t\treturn -EINVAL;\n \t\t} else if (err == 0) {\n \t\t\tif (tb[IFLA_MASTER])\n-\t\t\t\tbr_idx = nla_get_u32(tb[IFLA_MASTER]);\n+\t\t\t\t*br_idx = nla_get_u32(tb[IFLA_MASTER]);\n \t\t}\n \n-\t\tbrport_idx = ifm->ifi_index;\n+\t\t*brport_idx = ifm->ifi_index;\n \t}\n+\treturn 0;\n+}\n+\n+static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)\n+{\n+\tstruct net_device *dev;\n+\tstruct net_device *br_dev = NULL;\n+\tconst struct net_device_ops *ops = NULL;\n+\tconst struct net_device_ops *cops = NULL;\n+\tstruct net *net = sock_net(skb->sk);\n+\tstruct hlist_head *head;\n+\tint brport_idx = 0;\n+\tint br_idx = 0;\n+\tint h, s_h;\n+\tint idx = 0, s_idx;\n+\tint err = 0;\n+\tint fidx = 0;\n+\n+\terr = valid_fdb_dump_legacy(cb->nlh, &br_idx, &brport_idx,\n+\t\t\t\t    cb->extack);\n+\tif (err < 0)\n+\t\treturn err;\n \n \tif (br_idx) {\n \t\tbr_dev = __dev_get_by_index(net, br_idx);\n",
    "prefixes": [
        "v2",
        "net-next",
        "22/23"
    ]
}