Skip to content

Commit 8a7d61b

Browse files
mfijalkoborkmann
authored andcommitted
selftests/xsk: Add missing close() on netns fd
Commit 1034b03 ("selftests: xsk: Simplify cleanup of ifobjects") removed close on netns fd, which is not correct, so let us restore it. Fixes: 1034b03 ("selftests: xsk: Simplify cleanup of ifobjects") Signed-off-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Magnus Karlsson <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent c00c446 commit 8a7d61b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/bpf/xskxceiver.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,8 @@ static struct ifobject *ifobject_create(void)
16061606
if (!ifobj->umem)
16071607
goto out_umem;
16081608

1609+
ifobj->ns_fd = -1;
1610+
16091611
return ifobj;
16101612

16111613
out_umem:
@@ -1617,6 +1619,8 @@ static struct ifobject *ifobject_create(void)
16171619

16181620
static void ifobject_delete(struct ifobject *ifobj)
16191621
{
1622+
if (ifobj->ns_fd != -1)
1623+
close(ifobj->ns_fd);
16201624
free(ifobj->umem);
16211625
free(ifobj->xsk_arr);
16221626
free(ifobj);

0 commit comments

Comments
 (0)