[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ab6f14a-1cf9-cbe9-0019-6c4818327930@gmail.com>
Date: Sun, 7 Oct 2018 19:38:14 -0600
From: David Ahern <dsahern@...il.com>
To: Christian Brauner <christian@...uner.io>,
David Ahern <dsahern@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, jbenc@...hat.com,
stephen@...workplumber.org
Subject: Re: [PATCH net-next 19/20] net: Update netconf dump handlers for
strict data checking
On 10/7/18 4:53 AM, Christian Brauner wrote:
>> @@ -2076,6 +2077,21 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb,
>> struct in_device *in_dev;
>> struct hlist_head *head;
>>
>> + if (cb->strict_check) {
>> + struct netlink_ext_ack *extack = cb->extack;
>> + struct netconfmsg *ncm;
>> +
>> + if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ncm))) {
>> + NL_SET_ERR_MSG(extack, "Invalid header");
>> + return -EINVAL;
>> + }
>> +
>> + if (nlh->nlmsg_len != nlmsg_msg_size(sizeof(*ncm))) {
>> + NL_SET_ERR_MSG(extack, "Invalid data after header");
>> + return -EINVAL;
>> + }
>
> Hm, I think this could just be one branch with !=
> But if you've done this to report back a more meaningful error message
> to userspace, fine. :)
Consistency with other dump handlers and better userspace error
messages. If netconf ever gets a filter the length check is removed in
favor of nlmsg_parse_strict
Powered by blists - more mailing lists