Re: [PATCH nf] netfilter: nft_set_rbtree: bogus lookup/get on consecutive elements in named sets

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

 



Hi Pablo,

On Thu, Dec 05, 2019 at 07:07:06PM +0100, Pablo Neira Ayuso wrote:
> The existing rbtree implementation might store consecutive elements
> where the closing element and the opening element might overlap, eg.
> 
> 	[ a, a+1) [ a+1, a+2)
> 
> This patch removes the optimization for non-anonymous sets in the exact
> matching case, where it is assumed to stop searching in case that the
> closing element is found. Instead, invalidate candidate interval and
> keep looking further in the tree.
> 
> This patch fixes the lookup and get operations.

I didn't get what the actual problem is?

[...]
> diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
> index 57123259452f..510169e28065 100644
> --- a/net/netfilter/nft_set_rbtree.c
> +++ b/net/netfilter/nft_set_rbtree.c
[...]
> @@ -141,6 +146,8 @@ static bool __nft_rbtree_get(const struct net *net, const struct nft_set *set,
>  		} else {
>  			if (!nft_set_elem_active(&rbe->ext, genmask))
>  				parent = rcu_dereference_raw(parent->rb_left);
> +				continue;
> +			}
>  
>  			if (!nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) ||
>  			    (*nft_set_ext_flags(&rbe->ext) & NFT_SET_ELEM_INTERVAL_END) ==

Are you sure about that chunk? It adds a closing brace without a
matching opening one. Either this patch ignores whitespace change or
there's something fishy. :)

Cheers, Phil



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

  Powered by Linux