Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/980272/?format=api
{ "id": 980272, "url": "http://patchwork.ozlabs.org/api/patches/980272/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20181008031644.15989-11-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-11-dsahern@kernel.org>", "list_archive_url": null, "date": "2018-10-08T03:16:31", "name": "[v2,net-next,10/23] rtnetlink: Update rtnl_bridge_getlink for strict data checking", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "d0faf2fbeee0fdf2ef6f11f703544aa24cddeba0", "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-11-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/980272/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/980272/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=\"hmgok9ph\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 42T5Bp4hWSz9sCV\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tMon, 8 Oct 2018 14:17:22 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1727094AbeJHK0t (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tMon, 8 Oct 2018 06:26:49 -0400", "from mail.kernel.org ([198.145.29.99]:42652 \"EHLO mail.kernel.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1726920AbeJHK0U (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 8 Oct 2018 06:26:20 -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 889562087D;\n\tMon, 8 Oct 2018 03:16:49 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=default; t=1538968609;\n\tbh=0DwcQyxtJ1NQ6fYLgGLCXmBS/aYyYE80/5/hLznKlLg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hmgok9phsbzP6okgZQGDTmxIR3BC2DHpZFb1H2eYTr9/hGHEq15424ZUrIuuA2Iip\n\tDvSqTZN6bHI3+0Hc7EXZIk3RycLnmHpxSQPTeIMVFeDa65853synXskqJR7jIuJhi1\n\t4RUhe4g2gQIPq0AigXaU+5UJAIfpDfSqy9vzxg1w=", "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 10/23] rtnetlink: Update rtnl_bridge_getlink for\n\tstrict data checking", "Date": "Sun, 7 Oct 2018 20:16:31 -0700", "Message-Id": "<20181008031644.15989-11-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 rtnl_bridge_getlink for strict data checking. If the flag is set,\nthe dump request is expected to have an ifinfomsg 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 supported by the dump handler are allowed to be\nnon-0 or set in the request. At the moment only the IFLA_EXT_MASK\nattribute is supported.\n\nSigned-off-by: David Ahern <dsahern@gmail.com>\n---\n net/core/rtnetlink.c | 70 ++++++++++++++++++++++++++++++++++++++++++----------\n 1 file changed, 57 insertions(+), 13 deletions(-)", "diff": "diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c\nindex 12fd52105005..e38e1f178611 100644\n--- a/net/core/rtnetlink.c\n+++ b/net/core/rtnetlink.c\n@@ -4021,28 +4021,72 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,\n }\n EXPORT_SYMBOL_GPL(ndo_dflt_bridge_getlink);\n \n+static int valid_bridge_getlink_req(const struct nlmsghdr *nlh,\n+\t\t\t\t bool strict_check, u32 *filter_mask,\n+\t\t\t\t struct netlink_ext_ack *extack)\n+{\n+\tstruct nlattr *tb[IFLA_MAX+1];\n+\tint err, i;\n+\n+\tif (strict_check) {\n+\t\tstruct ifinfomsg *ifm;\n+\n+\t\tif (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {\n+\t\t\tNL_SET_ERR_MSG(extack, \"Invalid header for bridge link dump\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tifm = nlmsg_data(nlh);\n+\t\tif (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||\n+\t\t ifm->ifi_change || ifm->ifi_index) {\n+\t\t\tNL_SET_ERR_MSG(extack, \"Invalid values in header for bridge link dump request\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\terr = nlmsg_parse_strict(nlh, sizeof(struct ifinfomsg), tb,\n+\t\t\t\t\t IFLA_MAX, ifla_policy, extack);\n+\t} else {\n+\t\terr = nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb,\n+\t\t\t\t IFLA_MAX, ifla_policy, extack);\n+\t}\n+\tif (err < 0)\n+\t\treturn err;\n+\n+\t/* new attributes should only be added with strict checking */\n+\tfor (i = 0; i <= IFLA_MAX; ++i) {\n+\t\tif (!tb[i])\n+\t\t\tcontinue;\n+\n+\t\tswitch (i) {\n+\t\tcase IFLA_EXT_MASK:\n+\t\t\t*filter_mask = nla_get_u32(tb[i]);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tif (strict_check) {\n+\t\t\t\tNL_SET_ERR_MSG(extack, \"Unsupported attribute in bridge link dump request\");\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)\n {\n+\tconst struct nlmsghdr *nlh = cb->nlh;\n \tstruct net *net = sock_net(skb->sk);\n \tstruct net_device *dev;\n \tint idx = 0;\n \tu32 portid = NETLINK_CB(cb->skb).portid;\n-\tu32 seq = cb->nlh->nlmsg_seq;\n+\tu32 seq = nlh->nlmsg_seq;\n \tu32 filter_mask = 0;\n \tint err;\n \n-\tif (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) {\n-\t\tstruct nlattr *extfilt;\n-\n-\t\textfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg),\n-\t\t\t\t\t IFLA_EXT_MASK);\n-\t\tif (extfilt) {\n-\t\t\tif (nla_len(extfilt) < sizeof(filter_mask))\n-\t\t\t\treturn -EINVAL;\n-\n-\t\t\tfilter_mask = nla_get_u32(extfilt);\n-\t\t}\n-\t}\n+\terr = valid_bridge_getlink_req(nlh, cb->strict_check, &filter_mask,\n+\t\t\t\t cb->extack);\n+\tif (err < 0 && cb->strict_check)\n+\t\treturn err;\n \n \trcu_read_lock();\n \tfor_each_netdev_rcu(net, dev) {\n", "prefixes": [ "v2", "net-next", "10/23" ] }