aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-10-07 23:16:38 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-08 13:39:05 -0400
commitf80f14c3649f491e23712a30f86b20b6069fb72e (patch)
tree6251b6f21448a3433be5579ef7f0f2eb909889f3 /net/core/net_namespace.c
parent9632d47f6a88f7f075347b66b88c60df7e9eae05 (diff)
net/namespace: Update rtnl_net_dumpid for strict data checking
Update rtnl_net_dumpid for strict data checking. If the flag is set, the dump request is expected to have an rtgenmsg struct as the header which has the family as the only element. No data may be appended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 670c84b1bfc2..fefe72774aeb 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -853,6 +853,12 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb)
853 .s_idx = cb->args[0], 853 .s_idx = cb->args[0],
854 }; 854 };
855 855
856 if (cb->strict_check &&
857 nlmsg_attrlen(cb->nlh, sizeof(struct rtgenmsg))) {
858 NL_SET_ERR_MSG(cb->extack, "Unknown data in network namespace id dump request");
859 return -EINVAL;
860 }
861
856 spin_lock_bh(&net->nsid_lock); 862 spin_lock_bh(&net->nsid_lock);
857 idr_for_each(&net->netns_ids, rtnl_net_dumpid_one, &net_cb); 863 idr_for_each(&net->netns_ids, rtnl_net_dumpid_one, &net_cb);
858 spin_unlock_bh(&net->nsid_lock); 864 spin_unlock_bh(&net->nsid_lock);