selftests/bpf: Fix unmap bug in prog_tests/xdp_metadata.c
The function close_xsk() unmap via munmap() the wrong memory pointer.
The call xsk_umem__delete(xsk->umem) have already freed xsk->umem.
Thus the call to munmap(xsk->umem, UMEM_SIZE) will have unpredictable
behavior that can lead to Segmentation fault elsewhere, as man page
explain subsequent references to these pages will generate SIGSEGV.
Fixes: e2a46d54d7
("selftests/bpf: Verify xdp_metadata xdp->af_xdp path")
Reported-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/167527517464.938135.13750760520577765269.stgit@firesoul
This commit is contained in:
parent
36b0fb13b5
commit
f2922f77a6
@ -121,7 +121,7 @@ static void close_xsk(struct xsk *xsk)
|
||||
xsk_umem__delete(xsk->umem);
|
||||
if (xsk->socket)
|
||||
xsk_socket__delete(xsk->socket);
|
||||
munmap(xsk->umem, UMEM_SIZE);
|
||||
munmap(xsk->umem_area, UMEM_SIZE);
|
||||
}
|
||||
|
||||
static void ip_csum(struct iphdr *iph)
|
||||
|
Loading…
Reference in New Issue
Block a user