Re: [PATCH net-next 19/20] net: Update netconf dump handlers for strict data checking
From: David Ahern <hidden>
Date: 2018-10-08 08:47:30
From: David Ahern <hidden>
Date: 2018-10-08 08:47:30
On 10/7/18 4:53 AM, Christian Brauner wrote:
quoted
@@ -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