Skip to content

Commit d1fb555

Browse files
jmberg-inteldavem330
authored andcommitted
netlink: fix state reallocation in policy export
Evidently, when I did this previously, we didn't have more than 10 policies and didn't run into the reallocation path, because it's missing a memset() for the unused policies. Fix that. Fixes: d07dcf9 ("netlink: add infrastructure to expose policies to userspace") Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b4c8998 commit d1fb555

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/netlink/policy.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ static int add_policy(struct nl_policy_dump **statep,
5151
if (!state)
5252
return -ENOMEM;
5353

54+
memset(&state->policies[state->n_alloc], 0,
55+
flex_array_size(state, policies, n_alloc - state->n_alloc));
56+
5457
state->policies[state->n_alloc].policy = policy;
5558
state->policies[state->n_alloc].maxtype = maxtype;
5659
state->n_alloc = n_alloc;

0 commit comments

Comments
 (0)