On Thu, Oct 04, 2018 at 02:33:37PM -0700, David Ahern wrote: > From: David Ahern <dsah...@gmail.com> > > Give a user a reason why EINVAL is returned in nlmsg_parse. > > Signed-off-by: David Ahern <dsah...@gmail.com>
Acked-by: Christian Brauner <christ...@brauner.io> > --- > include/net/netlink.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/net/netlink.h b/include/net/netlink.h > index 589683091f16..9522a0bf1f3a 100644 > --- a/include/net/netlink.h > +++ b/include/net/netlink.h > @@ -516,8 +516,10 @@ static inline int nlmsg_parse(const struct nlmsghdr > *nlh, int hdrlen, > const struct nla_policy *policy, > struct netlink_ext_ack *extack) > { > - if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) > + if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { > + NL_SET_ERR_MSG(extack, "Invalid header length"); > return -EINVAL; > + } > > return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), > nlmsg_attrlen(nlh, hdrlen), policy, extack); > -- > 2.11.0 >