From patchwork Mon Jun 24 04:33:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13708891 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 69EFCC8FF; Mon, 24 Jun 2024 04:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719203697; cv=none; b=gubX+OxQfYzdXhJm/2TBehHpTg7W3ePL/+2TQMZ1CD94n/xsxPMtJ3rVmudT+h0khzXZ8cL86lwDiTLgqxSrv7ByWCMM+ciqF2ARleDK4FKwLjD4VrOtXDk+ydc1gpjxlm+cMfoGRuIllyF8pJsVc3XmNRYt0CRI+BwMfrvh8Lw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719203697; c=relaxed/simple; bh=77ptUYc9mTzaKoAWPDm8Ub6GybZslnYg2gGWI2kKJhA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ARaqXdTlg8jOjCVJlbbRYDmh7z7lO6rp2mZnuzmve+pewH/YQ73GuehuA59FAx+LsWbaoZQWiAE82eB9CxVcYhwinHY4OglL0wxKSS5YugsQ+HClFcw6JFbQh+pVvG1UC59mN96SL2elI9sYPBeC0gAkyedMAiMkG8aJUvNKDZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i52dzCmC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i52dzCmC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25F7FC32786; Mon, 24 Jun 2024 04:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719203696; bh=77ptUYc9mTzaKoAWPDm8Ub6GybZslnYg2gGWI2kKJhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i52dzCmCLBOPDBxDPD5M+wzykLF0Ajq4LDMaZeUP/rZuXgUcOBnVjzg982lmZEwu7 hwT19bAwOfnkr3vX+GCEHoV+cTGPMraybEbYdqstlyr3yTUlvQevKqv7/H51D4tYP/ EDlaT2NOKXWKUWQ7HQEMlMGmUr1E77HlTybFgswUhcbCgRzAWyoKJ5nm4878tLAExx sw0g5Y7Y0PuOp/qlzUcDG/07TgJv5v5ojS6ZilRNFSevRMdqROWT2a+SIGHSTzgaSd MPnvggzGoEmCCSMQox3tSLsTZJejSbJHnUz1/IYqLNmpFJ/cYA7zHRTh5OWjypFG5I YDZwe6+29Cjdg== From: Geliang Tang To: Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH bpf-next v4 5/9] selftests/bpf: Close fd in error path in drop_on_reuseport Date: Mon, 24 Jun 2024 12:33:52 +0800 Message-ID: <956fc734ac44a0b458b8819960cce2ee5a03dea1.1719203293.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Server 1 fd should be closed in the error path when update_lookup_map() fails. This patch fixes it by goto "close_srv1" instead of "detach" lable in that case. Signed-off-by: Geliang Tang Acked-by: Eduard Zingerman --- tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/sk_lookup.c b/tools/testing/selftests/bpf/prog_tests/sk_lookup.c index 597d0467a926..de2466547efe 100644 --- a/tools/testing/selftests/bpf/prog_tests/sk_lookup.c +++ b/tools/testing/selftests/bpf/prog_tests/sk_lookup.c @@ -994,7 +994,7 @@ static void drop_on_reuseport(const struct test *t) err = update_lookup_map(t->sock_map, SERVER_A, server1); if (err) - goto detach; + goto close_srv1; /* second server on destination address we should never reach */ server2 = make_server(t->sotype, t->connect_to.ip, t->connect_to.port,