Skip to content

Commit

Permalink
bpf: Use bpf_map_area_free instread of kvfree
Browse files Browse the repository at this point in the history
bpf_map_area_alloc() should be paired with bpf_map_area_free().

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/r/20220810151840.16394-3-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Yafang Shao authored and Alexei Starovoitov committed Aug 10, 2022
1 parent 0838181 commit 8f58ee5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/bpf/ringbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node)
err_free_pages:
for (i = 0; i < nr_pages; i++)
__free_page(pages[i]);
kvfree(pages);
bpf_map_area_free(pages);
return NULL;
}

Expand Down Expand Up @@ -190,7 +190,7 @@ static void bpf_ringbuf_free(struct bpf_ringbuf *rb)
vunmap(rb);
for (i = 0; i < nr_pages; i++)
__free_page(pages[i]);
kvfree(pages);
bpf_map_area_free(pages);
}

static void ringbuf_map_free(struct bpf_map *map)
Expand Down

0 comments on commit 8f58ee5

Please sign in to comment.