mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
selftests/bpf: Fix use-after-free in xdp_metadata test
ASAN reported a use-after-free in close_xsk(). The xsk->socket internally references xsk->umem via socket->ctx->umem, so the socket must be deleted before the umem. Fix the order of operations in close_xsk(). Acked-by: Mykyta Yatsenko <yatsenko@meta.com> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://lore.kernel.org/r/20260223190736.649171-14-ihor.solodrai@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
ff9511410d
commit
f7ac552be7
1 changed files with 2 additions and 2 deletions
|
|
@ -126,10 +126,10 @@ static int open_xsk(int ifindex, struct xsk *xsk)
|
|||
|
||||
static void close_xsk(struct xsk *xsk)
|
||||
{
|
||||
if (xsk->umem)
|
||||
xsk_umem__delete(xsk->umem);
|
||||
if (xsk->socket)
|
||||
xsk_socket__delete(xsk->socket);
|
||||
if (xsk->umem)
|
||||
xsk_umem__delete(xsk->umem);
|
||||
munmap(xsk->umem_area, UMEM_SIZE);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue