[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190321225046.t5aatcq6vtfxciox@breakpoint.cc>
Date: Thu, 21 Mar 2019 23:50:46 +0100
From: Florian Westphal <fw@...len.de>
To: Johannes Berg <johannes@...solutions.net>
Cc: netdev@...r.kernel.org, David Ahern <dsa@...ulusnetworks.com>,
Johannes Berg <johannes.berg@...el.com>
Subject: Re: [RFC 1/6] netlink: add nlmsg_validate_strict() &
nla_validate_strict()
Johannes Berg <johannes@...solutions.net> wrote:
> + * nla_validate_strict - Strictly validate a stream of attributes
> + * @head: head of attribute stream
> + * @len: length of attribute stream
> + * @maxtype: maximum attribute type to be expected
> + * @policy: validation policy
> + * @extack: extended ACK report struct
> + *
> + * Validates all attributes in the specified attribute stream against the
> + * specified policy. Attributes with a type exceeding maxtype will be
> + * ignored.
^^^^^^^^
rejected?
> +int nla_validate_strict(const struct nlattr *head, int len, int maxtype,
> + const struct nla_policy *policy,
> + struct netlink_ext_ack *extack)
> +{
> + const struct nlattr *nla;
> + int rem;
> +
> + nla_for_each_attr(nla, head, len, rem) {
> + u16 type = nla_type(nla);
> + int err;
> +
> + if (type == 0 || type > maxtype) {
> + NL_SET_ERR_MSG(extack, "Unknown attribute type");
Sure looks like it, and thats good.
Powered by blists - more mailing lists