Re: [PATCH nf v2] netfilter: nft_compat: don't use refcount_inc on newly allocated entry

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

 



On Tue, Feb 05, 2019 at 12:16:18PM +0100, Florian Westphal wrote:
> When I moved the refcount to refcount_t type I missed the fact that
> refcount_inc() will result in use-after-free warning with
> CONFIG_REFCOUNT_FULL=y builds.
> 
> The correct fix would be to init the reference count to 1 at allocation
> time, but, unfortunately we cannot do this, as we can't undo that
> in case something else fails later in the batch.
> 
> So only solution I see is to special-case the 'new entry' condition
> and replace refcount_inc() with a "delayed" refcount_set(1) in this case,
> as done here.
> 
> The .activate callback can be removed to simplify things, we only
> need to make sure that deactivate() decrements/unlinks the entry
> from the list at end of transaction phase (commit or abort).

Applied, thanks Florian.



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux