[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200819121006.7f6615e4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 19 Aug 2020 12:10:06 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: netdev@...r.kernel.org, Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH] netlink: fix state reallocation in policy export
On Wed, 19 Aug 2020 12:22:55 +0200 Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@...el.com>
>
> 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: d07dcf9aadd6 ("netlink: add infrastructure to expose policies to userspace")
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
> ---
> net/netlink/policy.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/netlink/policy.c b/net/netlink/policy.c
> index f6491853c797..3f3b421fd70c 100644
> --- a/net/netlink/policy.c
> +++ b/net/netlink/policy.c
> @@ -51,6 +51,9 @@ static int add_policy(struct nl_policy_dump **statep,
> if (!state)
> return -ENOMEM;
>
> + memset(&state->policies[state->n_alloc], 0,
> + sizeof(state->policies[0]) * (n_alloc - state->n_alloc));
[flex_]array_size() ? To avoid the inevitable follow up from a bot..
Powered by blists - more mailing lists