提交 39f3b41a 编写于 作者: P Paolo Abeni 提交者: David S. Miller

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: c10e6cf8 ("net: genetlink: push attrbuf allocation and parsing to a separate function")
Fixes: ab5b526d ("net: genetlink: always allocate separate attrs for dumpit ops")
Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
Reviewed-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3e72dfdf
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册