From nobody Thu Oct 2 02:15:07 2025 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5372330FF1E; Wed, 24 Sep 2025 14:50:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758725424; cv=none; b=k89vbRz5/s6iKBY/fFomWDZ+aQTiHaVi1vf49715MpYEgtUN80kKm3nVUsxDMfljkDSjsrzp7USTMLQxPNGKu2GZQUOdyOuag4dja4oiiXuUsIERSz0/EXQ6Hrt7ALbE5gEsf5EQ86s6l5mSozgMNugh2VvmyFrBaqz7kGJ8vRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758725424; c=relaxed/simple; bh=UTdAvwzTJVJsJdRBIZqx8UYFILV84IUDYUjjD/LqFMo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TyfGX7eVo2bxbsEuaVN8M1YKWxYYOtQ5usd0JzZTNARuVGvkxcs/tp93RJAu/lxBQ+kfmKuIyZu9hyy1B98tIxK+B7MNJ/Ju17m0U0Dp/ICchO/w7g72Z1QKibd7nliMy0tWlKOQT9MCjVMhvES6ihhV8OvrNT7w922q2F4tbic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=KMYvXsPe; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="KMYvXsPe" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C8C074E40D42; Wed, 24 Sep 2025 14:50:20 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9880F60634; Wed, 24 Sep 2025 14:50:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 930A0102F18D8; Wed, 24 Sep 2025 16:50:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1758725419; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Q1E9t3HMoWk9uJ51+vn11N7Peundo5w+fDZjVfqj1wI=; b=KMYvXsPexTAT3Zn+96Jc8Fmdd82VplypsaD0xAbHsUNycXNbBELH4z2k6j1pEUy7Eg+y8L e0NQN+cF46+E+bthAY2FbF8KaUaZruBOGb5mJz/LIbdkKVSG+mE1e9PJJl9mX3Dd/LYJul Tbo9InXRwx6XZofqiwL6HdFZOtAl0UeHugEryyMzRvXNLIvRDTcF3oP++D5mKCKzh9UqR0 9f/HOpEavmKykYZTd6OR0Xyi4b+42SY0Fr+nqmj2kQXgILs/Uk1SPZd1oEGFypyVzgUaUQ k4Bw5yOS8Vj58+VCEMWaXXFEP2T9e57Z4EfHsQEzTBUWHzVQm6A56ES49prcjA== From: "Bastien Curutchet (eBPF Foundation)" Date: Wed, 24 Sep 2025 16:49:42 +0200 Subject: [PATCH bpf-next v4 07/15] selftests/bpf: test_xsk: Release resources when swap fails Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250924-xsk-v4-7-20e57537b876@bootlin.com> References: <20250924-xsk-v4-0-20e57537b876@bootlin.com> In-Reply-To: <20250924-xsk-v4-0-20e57537b876@bootlin.com> To: =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: Thomas Petazzoni , Alexis Lothore , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (eBPF Foundation)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 testapp_validate_traffic() doesn't release the sockets and the umem created by the threads if the test isn't currently in its last step. Thus, if the swap_xsk_resources() fails before the last step, the created resources aren't cleaned up. Clean the sockets and the umem in case of swap_xsk_resources() failure. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/test_xsk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_xsk.c b/tools/testing/selftes= ts/bpf/test_xsk.c index 84b724731e26d0c7e67131ec1bd562e223d3d09d..8fe75845d7a6aa5342229fa419f= cbaa411ae9e70 100644 --- a/tools/testing/selftests/bpf/test_xsk.c +++ b/tools/testing/selftests/bpf/test_xsk.c @@ -1866,8 +1866,13 @@ int testapp_xdp_prog_cleanup(struct test_spec *test) if (testapp_validate_traffic(test)) return TEST_FAILURE; =20 - if (swap_xsk_resources(test)) + if (swap_xsk_resources(test)) { + clean_sockets(test, test->ifobj_rx); + clean_sockets(test, test->ifobj_tx); + clean_umem(test, test->ifobj_rx, test->ifobj_tx); return TEST_FAILURE; + } + return testapp_validate_traffic(test); } =20 --=20 2.51.0