Re: [PATCH net-next 19/32] netfilter: nft_connlimit: move stateful fields out of expression data

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

 



On 10.01.22 01:16, Pablo Neira Ayuso wrote:
> In preparation for the rule blob representation.
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
> ---
>  net/netfilter/nft_connlimit.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/net/netfilter/nft_connlimit.c b/net/netfilter/nft_connlimit.c
> index 7d0761fad37e..58dcafe8bf79 100644
> --- a/net/netfilter/nft_connlimit.c
> +++ b/net/netfilter/nft_connlimit.c

[...]

>  
>  static int nft_connlimit_do_dump(struct sk_buff *skb,
> @@ -200,7 +205,11 @@ static int nft_connlimit_clone(struct nft_expr *dst, const struct nft_expr *src)
>  	struct nft_connlimit *priv_dst = nft_expr_priv(dst);
>  	struct nft_connlimit *priv_src = nft_expr_priv(src);
>  
> -	nf_conncount_list_init(&priv_dst->list);
> +	priv_dst->list = kmalloc(sizeof(*priv_dst->list), GFP_ATOMIC);
> +	if (priv_dst->list)
> +		return -ENOMEM;
> +
> +	nf_conncount_list_init(priv_dst->list);
>  	priv_dst->limit	 = priv_src->limit;
>  	priv_dst->invert = priv_src->invert;
>  

Hi Pablo,

Coverity (CID 1510697) spotted a typo in this NULL check, it should be

	if (!priv_dst->list)
		return -ENOMEM;


Looks like the following patches also have this bug.



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

  Powered by Linux