Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp110741ybg; Mon, 8 Jun 2020 17:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw572L4o9nCuILyqLOX0jouxyKOqDLJPv2JzqAyyFTh3CI+407C+pC70TWp5IWqXjOecDNn X-Received: by 2002:a17:906:48d8:: with SMTP id d24mr15833049ejt.369.1591664072543; Mon, 08 Jun 2020 17:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664072; cv=none; d=google.com; s=arc-20160816; b=i1afcl2lPQfs99gGbWIWqX8w5UD7cjmVHFP+2Xu6tUJ1ycP6pYgr9ciDfQTrbUYW9C btSSqamQ0MHaK0xXMXKTnKqvE/kBSzbX/8E9DaIQZcoLmh5x1NjKAYo0UP1uJoaBpb5x 8dm5j4NWrmEq4n8wAMms+r6JpYumNnPkWbJOhXD88q1Jv3cfTsPpGsOxXnLp0OPmfmaq WrScuZdWWbnhknUHXsx/EAQz70QHamXmZhamaZ8GGdbMWuxh3/U4a6RWdrkRjPfQPoaE EWQFJH+GN0jFEMP+ZW9i2jNzbPbQt0fj7lBivjKRLlQNAJ7K5d6N2UiccmucktzVztvp OcQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+PfGHQrdEh2ogFU+qDQCM4KTgEpYANj7jTuxykdUxIE=; b=cViuoKoQR3RwEq1oUMNgo9TTD6pru/xhhN9i2Q+w+sDywlGY6OWaFMNb48SR3YWi3G bh6dGKiUvFgAY5PkDostT3rq1TRFk8s+U/D53ZRa3Ir5mxiZTf3HJ0GIPn70D0IokSX5 v2ErqwK9BhVpVGg+VCbaXum8j63s8DxoV924knWuI9Emi8IP64sGh1vfe9/xHGhrrYri vLWmctHycU5y4Q9kfQDrWLrAxfpV8ap5YDbcJ0gOmG1plwOPNf7YvQfpEQykFTB9zg+4 IGD3BUc9IVTMI2vb3snbTk9X+9cgiPI9zEHpJC0+s2RzpCDSDi0AUwRO+zNp2TqmQND2 oR7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lTxNbrXd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si9662905ejr.283.2020.06.08.17.54.09; Mon, 08 Jun 2020 17:54:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lTxNbrXd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728559AbgFHXKD (ORCPT + 99 others); Mon, 8 Jun 2020 19:10:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:54746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbgFHXJH (ORCPT ); Mon, 8 Jun 2020 19:09:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAC5120897; Mon, 8 Jun 2020 23:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657746; bh=gxk9MSh3P8MPirDz3R+VvLbXVPW8bi0sEi+cQ9ZIbSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lTxNbrXd+EOIMJt2pS99zyO2GfR0vIAOu4a+fGMlJwKVArStOjHwFJNWkQPh7/9bc P8DDXjDBa1lrJAe6NRyVD4rNwoczRNN6Xwvg2lJ2Ria87y/i6a5lzSTZJVNc90SVGk DE+a9f39QHE+UAU7aQ/ab9wHqtbOlUqYtJRzOkvA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andrii Nakryiko , Alexei Starovoitov , Carlos Neira , Sasha Levin , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 134/274] selftests/bpf: Fix bpf_link leak in ns_current_pid_tgid selftest Date: Mon, 8 Jun 2020 19:03:47 -0400 Message-Id: <20200608230607.3361041-134-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrii Nakryiko [ Upstream commit 8d30e80a049ad699264e4a12911e349f93c7279a ] If condition is inverted, but it's also just not necessary. Fixes: 1c1052e0140a ("tools/testing/selftests/bpf: Add self-tests for new helper bpf_get_ns_current_pid_tgid.") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Cc: Carlos Neira Link: https://lore.kernel.org/bpf/20200429012111.277390-11-andriin@fb.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c index 542240e16564..e74dc501b27f 100644 --- a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c +++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c @@ -80,9 +80,6 @@ void test_ns_current_pid_tgid(void) "User pid/tgid %llu BPF pid/tgid %llu\n", id, bss.pid_tgid)) goto cleanup; cleanup: - if (!link) { - bpf_link__destroy(link); - link = NULL; - } + bpf_link__destroy(link); bpf_object__close(obj); } -- 2.25.1