Skip to content

Commit

Permalink
net: genetlink: return the error code when attribute parsing fails.
Browse files Browse the repository at this point in the history
Currently if attribute parsing fails and the genl family
does not support parallel operation, the error code returned
by __nlmsg_parse() is discarded by genl_family_rcv_msg_attrs_parse().

Be sure to report the error for all genl families.

Fixes: c10e6cf ("net: genetlink: push attrbuf allocation and parsing to a separate function")
Fixes: ab5b526 ("net: genetlink: always allocate separate attrs for dumpit ops")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Paolo Abeni authored and David S. Miller committed Feb 23, 2020
1 parent 3e72dfd commit 39f3b41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,9 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family,

err = __nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr,
family->policy, validate, extack);
if (err && parallel) {
kfree(attrbuf);
if (err) {
if (parallel)
kfree(attrbuf);
return ERR_PTR(err);
}
return attrbuf;
Expand Down

0 comments on commit 39f3b41

Please sign in to comment.