From: Johannes Berg <[email protected]>

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 <[email protected]>
---
 net/netlink/policy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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) {
-- 
2.26.2

Reply via email to