Re: [PATCH nft] evaluate: fix double free on dtype release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux