[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <744e56db-c28d-2207-f5c1-8ba15a7aa95e@gmail.com>
Date: Fri, 18 Jan 2019 07:24:59 -0700
From: David Ahern <dsahern@...il.com>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>, davem@...emloft.net
Cc: netdev@...r.kernel.org, oss-drivers@...ronome.com
Subject: Re: [PATCH net-next 07/13] net: ipv4: ipmr: perform strict checks
also for doit handlers
On 1/17/19 3:52 PM, Jakub Kicinski wrote:
> + rtm = nlmsg_data(nlh);
> + if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) ||
> + (rtm->rtm_dst_len && rtm->rtm_dst_len != 32) ||
> + rtm->rtm_tos || rtm->rtm_table || rtm->rtm_protocol ||
> + rtm->rtm_scope || rtm->rtm_type || rtm->rtm_flags) {
> + NL_SET_ERR_MSG(extack, "ipv4: MR invalid values in header for route get request");
The MR at the beginning makes that read awkwardly. Perhaps:
ipv4: Invalid values in header for multicast route get request
> + return -EINVAL;
> + }
> +
> + err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX,
> + rtm_ipv4_policy, extack);
> + if (err)
> + return err;
> +
> + if ((tb[RTA_SRC] && !rtm->rtm_src_len) ||
> + (tb[RTA_DST] && !rtm->rtm_dst_len)) {
> + NL_SET_ERR_MSG(extack, "ipv4: MR rtm_src_len and rtm_dst_len must be 32 for IPv4");
and here. Also ipv4 is listed twice.
> + return -EINVAL;
> + }
> +
> + for (i = 0; i <= RTA_MAX; i++) {
> + if (!tb[i])
> + continue;
> +
> + switch (i) {
> + case RTA_SRC:
> + case RTA_DST:
> + case RTA_TABLE:
> + break;
> + default:
> + NL_SET_ERR_MSG(extack, "ipv4: MR unsupported attribute in route get request");
and here
Powered by blists - more mailing lists