Skip to contentSkip to conversation

netlink: Return extack message if attribute validation fails

PATCH Applied [email protected] 2 participants 2 messages Jun 26, 2018 – Jun 28, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: Return extack message if attribute validation fails

From: David Ahern <[email protected]>

Have one extack message for parsing and validating.

---
 lib/nlattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/nlattr.c +2 -2
index dfa55c873c13..e335bcafa9e4 100644
@@ -253,8 +253,8 @@ 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)
-						extack->bad_attr = nla;
+					NL_SET_ERR_MSG_ATTR(extack, nla,
+							    "Attribute failed policy validation");
 					goto errout;
 				}
 			}
Signature · 1 line
2.11.0