All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Thomas Haller <thaller@redhat.com>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] evaluate: fix double free on dtype release
Date: Tue, 5 Dec 2023 18:20:03 +0100	[thread overview]
Message-ID: <ZW9bwmBg1erhWwWv@calendula> (raw)
In-Reply-To: <2256864bab0e4834db0e2e69c8843fe8832212ee.camel@redhat.com>

On Tue, Dec 05, 2023 at 05:53:06PM +0100, Thomas Haller wrote:
> On Tue, 2023-12-05 at 15:19 +0100, Pablo Neira Ayuso wrote:
> > On Tue, Dec 05, 2023 at 01:08:17PM +0100, Florian Westphal wrote:
> > >  
> > > -	prefix->dtype	  = base->dtype;
> > > +	prefix->dtype	  = datatype_get(base->dtype);
> > 
> > I prefer datatype_clone() just in case base->dtype gets updated for
> > whatever reason.
> 
> Hi,
> 
> That seems unnecessary.
> 
> `struct datatype` is a ref-counted, immutable data structure. That is a
> great feature and callers should rely on it.
> 
> In "[PATCH nft 0/5] more various cleanups related to struct datatype"
> all modifications move inside "datatype.c". This makes it clearer that
> modifications happen during initialization only. Regardless, also on
> `master` the instance is never mutated, after passing around the
> pointer.

datatype_get() is perfectly fine for this case as you point out.
No update of prefix->prefix datatype is done indeed.

Thanks.

      reply	other threads:[~2023-12-05 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 12:08 [PATCH nft] evaluate: fix double free on dtype release Florian Westphal
2023-12-05 14:19 ` Pablo Neira Ayuso
2023-12-05 16:53   ` Thomas Haller
2023-12-05 17:20     ` Pablo Neira Ayuso [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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=ZW9bwmBg1erhWwWv@calendula \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=thaller@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.