Message ID | 20201002110205.73a89b98cf10.I78718edf29745b8e5f5ea2d289e59c8884fdd8c7@changeid |
---|---|
State | New |
Headers | show |
Series | genetlink: complete policy dumping | expand |
On Fri, 2 Oct 2020 11:09:41 +0200 Johannes Berg wrote: > From: Johannes Berg <johannes.berg@intel.com> > > The maxtype is really an integral part of the policy, and while we > haven't gotten into a situation yet where this happens, it seems > that some developer might eventually have two places pointing to > identical policies, with different maxattr to exclude some attrs > in one of the places. > > Even if not, it's really the right thing to compare both since the > two data items fundamentally belong together. > > Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org>
diff --git a/net/netlink/policy.c b/net/netlink/policy.c index 2a0d85cbc0a2..7bc8f81ecc43 100644 --- a/net/netlink/policy.c +++ b/net/netlink/policy.c @@ -35,7 +35,8 @@ static int add_policy(struct netlink_policy_dump_state **statep, return 0; for (i = 0; i < state->n_alloc; i++) { - if (state->policies[i].policy == policy) + if (state->policies[i].policy == policy && + state->policies[i].maxtype == maxtype) return 0; if (!state->policies[i].policy) {