Netdev Archive on
help / color / mirror / Atom feed
From: Johannes Berg <>
To: Jakub Kicinski <>
Subject: Re: [PATCH] netlink: fix state reallocation in policy export
Date: Wed, 19 Aug 2020 21:52:15 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, 2020-08-19 at 12:10 -0700, Jakub Kicinski wrote:
> > +	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..

Yeah, hmm.

I suppose you know this but we can't really overflow anything here since
all of the factors are kernel controlled; you can't really have enough
policies in memory to overflow this, I'd think. We walk the constant
policies and their nested policies - nl80211 is a *heavy* user and only
recently went >10 policies linked together (triggering the bug)...

Really what we need is kzrealloc() ;-)

I'll send a v2 using flex_array_size(), it doesn't look any worse and I
don't care about the overflow check either since it's not at all a fast-


      reply	other threads:[~2020-08-19 19:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 10:22 Johannes Berg
2020-08-19 19:10 ` Jakub Kicinski
2020-08-19 19:52   ` Johannes Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: [PATCH] netlink: fix state reallocation in policy export' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).