netfilter: nf_tables: Modify nla_memdup's flag to GFP_KERNEL_ACCOUNT
authorChen Aotian <chenaotian2@163.com>
Thu, 6 Apr 2023 04:01:51 +0000 (12:01 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 6 Apr 2023 09:33:52 +0000 (11:33 +0200)
For memory alloc that store user data from nla[NFTA_OBJ_USERDATA],
use GFP_KERNEL_ACCOUNT is more suitable.

Fixes: 33758c891479 ("memcg: enable accounting for nft objects")
Signed-off-by: Chen Aotian <chenaotian2@163.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index 6004d4b..cd52109 100644 (file)
@@ -7052,7 +7052,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info,
        }
 
        if (nla[NFTA_OBJ_USERDATA]) {
-               obj->udata = nla_memdup(nla[NFTA_OBJ_USERDATA], GFP_KERNEL);
+               obj->udata = nla_memdup(nla[NFTA_OBJ_USERDATA], GFP_KERNEL_ACCOUNT);
                if (obj->udata == NULL)
                        goto err_userdata;