1
0
Fork 0

net: genetlink: return the error code when attribute parsing fails.

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: c10e6cf85e ("net: genetlink: push attrbuf allocation and parsing to a separate function")
Fixes: ab5b526da0 ("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>
alistair/sensors
Paolo Abeni 2020-02-21 19:42:13 +01:00 committed by David S. Miller
parent 3e72dfdf82
commit 39f3b41aa7
1 changed files with 3 additions and 2 deletions

View File

@ -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;