]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix release of page_pool in BPF_PROG_RUN in test runner
authorToke Høiland-Jørgensen <toke@redhat.com>
Sat, 9 Apr 2022 21:30:53 +0000 (23:30 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 11 Apr 2022 15:30:15 +0000 (17:30 +0200)
commitde135cb7ea0f0574f5a1628e7c86ab586eb80e70
tree5c36b76183ec31c02b4fb1f43e523e9095cddb6c
parent213cfb8becd1e69a25c551b984d587b94839e5be
bpf: Fix release of page_pool in BPF_PROG_RUN in test runner

The live packet mode in BPF_PROG_RUN allocates a page_pool instance for
each test run instance and uses it for the packet data. On setup it creates
the page_pool, and calls xdp_reg_mem_model() to allow pages to be returned
properly from the XDP data path. However, xdp_reg_mem_model() also raises
the reference count of the page_pool itself, so the single
page_pool_destroy() count on teardown was not enough to actually release
the pool. To fix this, add an additional xdp_unreg_mem_model() call on
teardown.

Fixes: c23b8c0ec3f7 ("bpf: Add "live packet" mode for XDP in BPF_PROG_RUN")
Reported-by: Freysteinn Alfredsson <freysteinn.alfredsson@kau.se>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20220409213053.3117305-1-toke@redhat.com
net/bpf/test_run.c