bpf: Use __llist_del_all() whenever possbile during memory draining
[platform/kernel/linux-starfive.git] / kernel / bpf / devmap.c
index a0e02b0..f9a87dc 100644 (file)
@@ -163,13 +163,13 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
        if (!capable(CAP_NET_ADMIN))
                return ERR_PTR(-EPERM);
 
-       dtab = kzalloc(sizeof(*dtab), GFP_USER | __GFP_ACCOUNT);
+       dtab = bpf_map_area_alloc(sizeof(*dtab), NUMA_NO_NODE);
        if (!dtab)
                return ERR_PTR(-ENOMEM);
 
        err = dev_map_init_map(dtab, attr);
        if (err) {
-               kfree(dtab);
+               bpf_map_area_free(dtab);
                return ERR_PTR(err);
        }
 
@@ -240,7 +240,7 @@ static void dev_map_free(struct bpf_map *map)
                bpf_map_area_free(dtab->netdev_map);
        }
 
-       kfree(dtab);
+       bpf_map_area_free(dtab);
 }
 
 static int dev_map_get_next_key(struct bpf_map *map, void *key, void *next_key)