summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-06-26 12:39:18 -0700
committerDavid S. Miller <davem@davemloft.net>2018-06-28 16:18:04 +0900
commit7861552cedd81a164c0d5d1c89fe2cb45a3ed41b (patch)
tree6559edb4584e42686007d9d5131ba72643289d61
parent8d0752d11312be830c33e84dfd1016e6a47c2938 (diff)
downloadlinux-stable-7861552cedd81a164c0d5d1c89fe2cb45a3ed41b.tar.gz
linux-stable-7861552cedd81a164c0d5d1c89fe2cb45a3ed41b.tar.bz2
linux-stable-7861552cedd81a164c0d5d1c89fe2cb45a3ed41b.zip
netlink: Return extack message if attribute validation fails
Have one extack message for parsing and validating. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--lib/nlattr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/nlattr.c b/lib/nlattr.c
index dfa55c873c13..e335bcafa9e4 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -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;
}
}