提交 f80f14c3 编写于 作者: D David Ahern 提交者: David S. Miller

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: NDavid Ahern <dsahern@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9632d47f
...@@ -853,6 +853,12 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -853,6 +853,12 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb)
.s_idx = cb->args[0], .s_idx = cb->args[0],
}; };
if (cb->strict_check &&
nlmsg_attrlen(cb->nlh, sizeof(struct rtgenmsg))) {
NL_SET_ERR_MSG(cb->extack, "Unknown data in network namespace id dump request");
return -EINVAL;
}
spin_lock_bh(&net->nsid_lock); spin_lock_bh(&net->nsid_lock);
idr_for_each(&net->netns_ids, rtnl_net_dumpid_one, &net_cb); idr_for_each(&net->netns_ids, rtnl_net_dumpid_one, &net_cb);
spin_unlock_bh(&net->nsid_lock); spin_unlock_bh(&net->nsid_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册