This patch sets a generic netlink error message if the validation of the netlink attribute failed. It avoids several different settings of netlink messages by handle nla_parse_nested on error case.
Suggested-by: David Ahern <dsah...@gmail.com> Signed-off-by: Alexander Aring <ar...@mojatatu.com> --- lib/nlattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nlattr.c b/lib/nlattr.c index dfa55c873c13..a2a9506b2fb7 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -253,8 +253,10 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, if (policy) { err = validate_nla(nla, maxtype, policy); if (err < 0) { - if (extack) + if (extack) { + NL_SET_ERR_MSG(extack, "Failed to validate netlink attribute"); extack->bad_attr = nla; + } goto errout; } } -- 2.11.0