selftests/xsk: Add missing close() on netns fd

Commit 1034b03e54 ("selftests: xsk: Simplify cleanup of ifobjects")
removed close on netns fd, which is not correct, so let us restore it.

Fixes: 1034b03e54 ("selftests: xsk: Simplify cleanup of ifobjects")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20220830133905.9945-1-maciej.fijalkowski@intel.com
This commit is contained in:
Maciej Fijalkowski 2022-08-30 15:39:05 +02:00 committed by Daniel Borkmann
parent c00c446168
commit 8a7d61bdc2

View File

@ -1606,6 +1606,8 @@ static struct ifobject *ifobject_create(void)
if (!ifobj->umem)
goto out_umem;
ifobj->ns_fd = -1;
return ifobj;
out_umem:
@ -1617,6 +1619,8 @@ out_xsk_arr:
static void ifobject_delete(struct ifobject *ifobj)
{
if (ifobj->ns_fd != -1)
close(ifobj->ns_fd);
free(ifobj->umem);
free(ifobj->xsk_arr);
free(ifobj);