genetlink: do not validate dump requests if there is no policy
authorMichal Kubecek <mkubecek@suse.cz>
Thu, 2 May 2019 14:15:10 +0000 (16:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 May 2019 05:27:10 +0000 (01:27 -0400)
commit05d7f547bea1872e711ee97bd46aace6cf61c42b
tree83d6f89440d326c510ca3546a6468590389ae548
parent5eabc27dedd30a738e50a80cdb184b94d2a2ef05
genetlink: do not validate dump requests if there is no policy

Unlike do requests, dump genetlink requests now perform strict validation
by default even if the genetlink family does not set policy and maxtype
because it does validation and parsing on its own (e.g. because it wants to
allow different message format for different commands). While the null
policy will be ignored, maxtype (which would be zero) is still checked so
that any attribute will fail validation.

The solution is to only call __nla_validate() from genl_family_rcv_msg()
if family->maxtype is set.

Fixes: ef6243acb478 ("genetlink: optionally validate strictly/dumps")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/genetlink.c