Re: [PATCH v2 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store userdata for nft_table

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

 



Quan Tian <tianquan23@xxxxxxxxx> wrote:
> To prepare for the support for table comment updates, the patch changes
> to store userdata in struct nlattr *, which can be updated atomically on
> updates.
> 
> Signed-off-by: Quan Tian <tianquan23@xxxxxxxxx>
> ---
> v2: Change to store userdata in struct nlattr * to ensure atomical update

Looks good, one minor nit below.

>  	if (nla[NFTA_TABLE_USERDATA]) {
> -		table->udata = nla_memdup(nla[NFTA_TABLE_USERDATA], GFP_KERNEL_ACCOUNT);
> +		table->udata = kmemdup(nla[NFTA_TABLE_USERDATA],
> +				       nla_total_size(nla_len(nla[NFTA_TABLE_USERDATA])),
> +				       GFP_KERNEL_ACCOUNT);

I think its correct but it might make sense to add a small helper for
this kmemdup so we don't need to copypaste in case this should get
extended to e.g. chain udata update support.




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

  Powered by Linux