Skip to content

Commit

Permalink
net/namespace: Update rtnl_net_dumpid for strict data checking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Ahern authored and David S. Miller committed Oct 8, 2018
1 parent 9632d47 commit f80f14c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,12 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb)
.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);
idr_for_each(&net->netns_ids, rtnl_net_dumpid_one, &net_cb);
spin_unlock_bh(&net->nsid_lock);
Expand Down

0 comments on commit f80f14c

Please sign in to comment.