* [PATCH net] net: genetlink: return the error code when attribute parsing fails.
@ 2020-02-21 18:42 Paolo Abeni
2020-02-22 6:54 ` Jiri Pirko
2020-02-23 6:00 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Paolo Abeni @ 2020-02-21 18:42 UTC (permalink / raw)
To: netdev; +Cc: Jakub Kicinski, David S. Miller, Jiri Pirko
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: c10e6cf85e7d ("net: genetlink: push attrbuf allocation and parsing to a separate function")
Fixes: ab5b526da048 ("net: genetlink: always allocate separate attrs for dumpit ops")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
Note: the issue is really introduced by the first commit above,
but the fix applies cleanly only after the 2nd one
---
net/netlink/genetlink.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 0522b2b1fd95..9f357aa22b94 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -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;
--
2.21.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: genetlink: return the error code when attribute parsing fails.
2020-02-21 18:42 [PATCH net] net: genetlink: return the error code when attribute parsing fails Paolo Abeni
@ 2020-02-22 6:54 ` Jiri Pirko
2020-02-23 6:00 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2020-02-22 6:54 UTC (permalink / raw)
To: Paolo Abeni; +Cc: netdev, Jakub Kicinski, David S. Miller, Jiri Pirko
Fri, Feb 21, 2020 at 07:42:13PM CET, pabeni@redhat.com wrote:
>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: c10e6cf85e7d ("net: genetlink: push attrbuf allocation and parsing to a separate function")
>Fixes: ab5b526da048 ("net: genetlink: always allocate separate attrs for dumpit ops")
>Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: genetlink: return the error code when attribute parsing fails.
2020-02-21 18:42 [PATCH net] net: genetlink: return the error code when attribute parsing fails Paolo Abeni
2020-02-22 6:54 ` Jiri Pirko
@ 2020-02-23 6:00 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-02-23 6:00 UTC (permalink / raw)
To: pabeni; +Cc: netdev, kuba, jiri
From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, 21 Feb 2020 19:42:13 +0100
> 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: c10e6cf85e7d ("net: genetlink: push attrbuf allocation and parsing to a separate function")
> Fixes: ab5b526da048 ("net: genetlink: always allocate separate attrs for dumpit ops")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-23 6:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 18:42 [PATCH net] net: genetlink: return the error code when attribute parsing fails Paolo Abeni
2020-02-22 6:54 ` Jiri Pirko
2020-02-23 6:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).