get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 980256,
    "url": "http://patchwork.ozlabs.org/api/patches/980256/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20181008031644.15989-9-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-9-dsahern@kernel.org>",
    "list_archive_url": null,
    "date": "2018-10-08T03:16:29",
    "name": "[v2,net-next,08/23] net/ipv6: Update inet6_dump_addr for strict data checking",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5728f193cd3a0885cc51c55c5d12f68541831dd9",
    "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-9-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/980256/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/980256/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=\"e9zQgvXJ\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 42T5BD5Wggz9sCr\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tMon,  8 Oct 2018 14:16:52 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1726989AbeJHK0U (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tMon, 8 Oct 2018 06:26:20 -0400",
            "from mail.kernel.org ([198.145.29.99]:42626 \"EHLO mail.kernel.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1725950AbeJHK0T (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 8 Oct 2018 06:26:19 -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 01CD420841;\n\tMon,  8 Oct 2018 03:16:48 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=default; t=1538968609;\n\tbh=wpefWb33hO6AUYG/YnShl2unpkTLSjFAfRKnj2gZI80=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e9zQgvXJWukWRskX1xdevGELRiablk21ua7YeopJ7+3n3UcdbFVwGC+r00JFNxA78\n\tDJfdZKEnp48V2Fws6ryvd5Ifu7uKlwe0DKRcMed0vrWwkAN/NjH4TiMpXZStrN5O6g\n\tKOzaFWpDS6PHnmY2KkcKzXrub8xBAteU5n7U/qEk=",
        "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 08/23] net/ipv6: Update inet6_dump_addr for\n\tstrict data checking",
        "Date": "Sun,  7 Oct 2018 20:16:29 -0700",
        "Message-Id": "<20181008031644.15989-9-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\nUpdate inet6_dump_addr for strict data checking. If the flag is set, the\ndump request is expected to have an ifaddrmsg struct as the header\npotentially followed by one or more attributes. Any data passed in the\nheader or as an attribute is taken as a request to influence the data\nreturned. Only values suppored by the dump handler are allowed to be\nnon-0 or set in the request. At the moment only the IFA_TARGET_NETNSID\nattribute is supported. Follow on patches can add support for other fields\n(e.g., honor ifa_index and only return data for the given device index).\n\nSigned-off-by: David Ahern <dsahern@gmail.com>\n---\n net/ipv6/addrconf.c | 69 +++++++++++++++++++++++++++++++++++++++++++++--------\n 1 file changed, 59 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c\nindex afa279170ba5..095d3f56f0a9 100644\n--- a/net/ipv6/addrconf.c\n+++ b/net/ipv6/addrconf.c\n@@ -4998,9 +4998,62 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,\n \treturn err;\n }\n \n+static int inet6_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,\n+\t\t\t\t       struct inet6_fill_args *fillargs,\n+\t\t\t\t       struct net **tgt_net, struct sock *sk,\n+\t\t\t\t       struct netlink_ext_ack *extack)\n+{\n+\tstruct nlattr *tb[IFA_MAX+1];\n+\tstruct ifaddrmsg *ifm;\n+\tint err, i;\n+\n+\tif (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Invalid header for address dump request\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tifm = nlmsg_data(nlh);\n+\tif (ifm->ifa_prefixlen || ifm->ifa_flags || ifm->ifa_scope) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Invalid values in header for address dump request\");\n+\t\treturn -EINVAL;\n+\t}\n+\tif (ifm->ifa_index) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Filter by device index not supported for address dump\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\terr = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX,\n+\t\t\t\t ifa_ipv6_policy, extack);\n+\tif (err < 0)\n+\t\treturn err;\n+\n+\tfor (i = 0; i <= IFA_MAX; ++i) {\n+\t\tif (!tb[i])\n+\t\t\tcontinue;\n+\n+\t\tif (i == IFA_TARGET_NETNSID) {\n+\t\t\tstruct net *net;\n+\n+\t\t\tfillargs->netnsid = nla_get_s32(tb[i]);\n+\t\t\tnet = rtnl_get_net_ns_capable(sk, fillargs->netnsid);\n+\t\t\tif (IS_ERR(net)) {\n+\t\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Invalid target network namespace id\");\n+\t\t\t\treturn PTR_ERR(net);\n+\t\t\t}\n+\t\t\t*tgt_net = net;\n+\t\t} else {\n+\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Unsupported attribute in dump request\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,\n \t\t\t   enum addr_type_t type)\n {\n+\tconst struct nlmsghdr *nlh = cb->nlh;\n \tstruct inet6_fill_args fillargs = {\n \t\t.portid = NETLINK_CB(cb->skb).portid,\n \t\t.seq = cb->nlh->nlmsg_seq,\n@@ -5009,7 +5062,6 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,\n \t\t.type = type,\n \t};\n \tstruct net *net = sock_net(skb->sk);\n-\tstruct nlattr *tb[IFA_MAX+1];\n \tstruct net *tgt_net = net;\n \tint h, s_h;\n \tint idx, ip_idx;\n@@ -5022,16 +5074,13 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,\n \ts_idx = idx = cb->args[1];\n \ts_ip_idx = ip_idx = cb->args[2];\n \n-\tif (nlmsg_parse(cb->nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX,\n-\t\t\tifa_ipv6_policy, cb->extack) >= 0) {\n-\t\tif (tb[IFA_TARGET_NETNSID]) {\n-\t\t\tfillargs.netnsid = nla_get_s32(tb[IFA_TARGET_NETNSID]);\n+\tif (cb->strict_check) {\n+\t\tint err;\n \n-\t\t\ttgt_net = rtnl_get_net_ns_capable(skb->sk,\n-\t\t\t\t\t\t\t  fillargs.netnsid);\n-\t\t\tif (IS_ERR(tgt_net))\n-\t\t\t\treturn PTR_ERR(tgt_net);\n-\t\t}\n+\t\terr = inet6_valid_dump_ifaddr_req(nlh, &fillargs, &tgt_net,\n+\t\t\t\t\t\t  skb->sk, cb->extack);\n+\t\tif (err < 0)\n+\t\t\treturn err;\n \t}\n \n \trcu_read_lock();\n",
    "prefixes": [
        "v2",
        "net-next",
        "08/23"
    ]
}