Skip to contentSkip to conversation

selftests: xsk: add missing close() on netns fd

PATCH Applied Maciej Fijalkowski 2 participants 2 messages Aug 30, 2022 – Aug 31, 2022

Subsystems (6)
lore
Share & tools
lore

Maciej Fijalkowski

author maintainer
#0 lore raw

PATCH 1/1 selftests: xsk: add missing close() on netns fd

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

Fixes 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects")
---
 tools/testing/selftests/bpf/xskxceiver.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/bpf/xskxceiver.c +4 -0
index 333cf23c01b5..d64652558d12 100644
@@ -1698,6 +1698,8 @@ static struct ifobject *ifobject_create(void)
 	if (!ifobj->umem)
 		goto out_umem;
 
+	ifobj->ns_fd = -1;
+
 	return ifobj;
 
 out_umem:
@@ -1709,6 +1711,8 @@ static struct ifobject *ifobject_create(void)
 
 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);
Signature · 1 line
2.34.1
#1 lore raw
This patch was applied to bpf/bpf.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:

Quoted 8 lines · On Tue, 30 Aug 2022 15:39:05 +0200 you wrote:

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

Fixes 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects")

[...]

Here is the summary with links:
- [bpf] selftests: xsk: add missing close() on netns fd

    https://git.kernel.org/bpf/bpf/c/8a7d61bdc2fa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html