[PATCH nf-next 06/10] netfilter: ipset: use GFP_KERNEL_ACCOUNT
Pablo Neira Ayuso <[email protected]>
| Newsgroups | gmane.comp.security.firewalls.netfilter.devel |
|---|---|
| Message-ID | <[email protected]> |
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace GFP_KERNEL by GFP_KERNEL_ACCOUNT. Use GFP_KERNEL_ACCOUNT to allocate internal datastructures in ipset. Signed-off-by: Pablo Neira Ayuso <[email protected]> --- net/netfilter/ipset/ip_set_bitmap_ip.c | 2 +- net/netfilter/ipset/ip_set_bitmap_ipmac.c | 2 +- net/netfilter/ipset/ip_set_bitmap_port.c | 2 +- net/netfilter/ipset/ip_set_core.c | 7 ++++--- net/netfilter/ipset/ip_set_hash_gen.h | 6 +++--- net/netfilter/ipset/ip_set_list_set.c | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/net/netfilter/ipset/ip_set_bitmap_ip.c b/net/netfilter/ipset/ip_set_bitmap_ip.c index ac7febce074f..e152cf35d859 100644 --- a/net/netfilter/ipset/ip_set_bitmap_ip.c +++ b/net/netfilter/ipset/ip_set_bitmap_ip.c @@ -217,7 +217,7 @@ init_map_ip(struct ip_set *set, struct bitmap_ip *map, u32 first_ip, u32 last_ip, u32 elements, u32 hosts, u8 netmask) { - map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN); + map->members = bitmap_zalloc(elements, GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!map->members) return false; map->first_ip = first_ip; diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c index 5921fd9d2dca..a1179352220a 100644 --- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c +++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c @@ -300,7 +300,7 @@ static bool init_map_ipmac(struct ip_set *set, struct bitmap_ipmac *map, u32 first_ip, u32 last_ip, u32 elements) { - map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN); + map->members = bitmap_zalloc(elements, GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!map->members) return false; map->first_ip = first_ip; diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c index ca875c982424..0a0027cdb193 100644 --- a/net/netfilter/ipset/ip_set_bitmap_port.c +++ b/net/netfilter/ipset/ip_set_bitmap_port.c @@ -231,7 +231,7 @@ static bool init_map_port(struct ip_set *set, struct bitmap_port *map, u16 first_port, u16 last_port) { - map->members = bitmap_zalloc(map->elements, GFP_KERNEL | __GFP_NOWARN); + map->members = bitmap_zalloc(map->elements, GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!map->members) return false; map->first_port = first_port; diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 0a86a170ba90..28ac8cba3d68 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -1085,7 +1085,7 @@ static int ip_set_create(struct sk_buff *skb, const struct nfnl_info *info, /* First, and without any locks, allocate and initialize * a normal base set structure. */ - set = kzalloc_obj(*set); + set = kzalloc_obj(*set, GFP_KERNEL_ACCOUNT); if (!set) return -ENOMEM; spin_lock_init(&set->lock); @@ -1143,7 +1143,7 @@ static int ip_set_create(struct sk_buff *skb, const struct nfnl_info *info, /* Wraparound */ goto cleanup; - list = kvzalloc_objs(struct ip_set *, i); + list = kvzalloc_objs(struct ip_set *, i, GFP_KERNEL_ACCOUNT); if (!list) goto cleanup; /* nfnl mutex is held, both lists are valid */ @@ -2397,7 +2397,8 @@ ip_set_net_init(struct net *net) if (inst->ip_set_max >= IPSET_INVALID_ID) inst->ip_set_max = IPSET_INVALID_ID - 1; - list = kvzalloc_objs(struct ip_set *, inst->ip_set_max); + list = kvzalloc_objs(struct ip_set *, inst->ip_set_max, + GFP_KERNEL_ACCOUNT); if (!list) return -ENOMEM; inst->is_deleted = false; diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index 80ca523f304b..39dec9285052 100644 --- a/net/netfilter/ipset/ip_set_hash_gen.h +++ b/net/netfilter/ipset/ip_set_hash_gen.h @@ -768,7 +768,7 @@ mtype_resize(struct ip_set *set, bool retried) int ret; #ifdef IP_SET_HASH_WITH_NETS - tmp = kmalloc(dsize, GFP_KERNEL); + tmp = kmalloc(dsize, GFP_KERNEL_ACCOUNT); if (!tmp) return -ENOMEM; #endif @@ -1754,7 +1754,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set, sizeof(struct IPSET_TOKEN(HTYPE, 6)) : sizeof(struct IPSET_TOKEN(HTYPE, 4)); #endif - h = kzalloc(hsize, GFP_KERNEL); + h = kzalloc(hsize, GFP_KERNEL_ACCOUNT); if (!h) return -ENOMEM; @@ -1774,7 +1774,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set, goto free_t; #ifdef IP_SET_HASH_WITH_NETS for (i = 0; i < IPSET_NET_COUNT; i++) { - nets = kzalloc_obj(*nets); + nets = kzalloc_obj(*nets, GFP_KERNEL_ACCOUNT); if (!nets) { while (i > 0) kfree(rcu_dereference_raw(h->rnets[--i])); diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c index f070088742d6..750fe38261c3 100644 --- a/net/netfilter/ipset/ip_set_list_set.c +++ b/net/netfilter/ipset/ip_set_list_set.c @@ -600,7 +600,7 @@ init_list_set(struct net *net, struct ip_set *set, u32 size) { struct list_set *map; - map = kzalloc_obj(*map); + map = kzalloc_obj(*map, GFP_KERNEL_ACCOUNT); if (!map) return false; -- 2.47.3