Re: [PATCH 1/4] nf: netfilter: nf_tables_api: Add new attributes into nft_set to store user data.

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

 



On Sun, Jan 03, 2016 at 08:38:17PM +0100, Carlos Falgueras García wrote:
> @@ -2816,12 +2823,16 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
>  	if (IS_ERR(ops))
>  		return PTR_ERR(ops);
>  
> +	udlen = 0;
> +	if (nla[NFTA_SET_USERDATA])
> +		udlen = nla_len(nla[NFTA_SET_USERDATA]);
> +
>  	size = 0;
>  	if (ops->privsize != NULL)
>  		size = ops->privsize(nla);
>  
>  	err = -ENOMEM;
> -	set = kzalloc(sizeof(*set) + size, GFP_KERNEL);
> +	set = kzalloc(sizeof(*set) + size + udlen, GFP_KERNEL);
>  	if (set == NULL)
>  		goto err1;
>  
> @@ -2830,6 +2841,12 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
>  	if (err < 0)
>  		goto err2;
>  
> +	udata = NULL;
> +	if (nla[NFTA_SET_USERDATA]) {

I think this should be:

        if (udlen)

instead, to ignore zero length user data.

> +		udata = set->data + size;
> +		nla_memcpy(udata, nla[NFTA_SET_USERDATA], udlen);
> +	}
> +
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux