Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8618486ybn; Tue, 1 Oct 2019 10:39:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoewaHTs+GHE/prjAYdQueG/1lyLfInk9PVxfReIu9aOR4Ex0Kb3Ez93FA7G4Xcn2Wz34g X-Received: by 2002:a05:6402:1681:: with SMTP id a1mr26794904edv.218.1569951550716; Tue, 01 Oct 2019 10:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569951550; cv=none; d=google.com; s=arc-20160816; b=a+J3fGH/N2fLDGXCBhzPSImizruacrBnM+hak7zVglhVUjvHO5KGingm67jGLQ1GNT rEVti3vM6IKl3zTnkAda46ueCvOb2rv4W0txoOKmBPaqHYnRRNYFSMbeszzhbedNF9Ol MAGPUrj30VsW2wCc7Xy0iQGlr8rf+2Z6LD7dqZXu5hSTrEPmxsFqwYBZs2mTAUjnjudR IHbVH9xTUg+XJIBAjRVNkCeE6bX/E/d/1fkqrUbPQNm9k6JlhpBx4Z/JLALOuR5I4Mfk ySXVoAABp4UAEm5ZgeGK/6ojGOzx0JyXO8NDiVwAQM4W0TXbo2NxCun5WNUyVOXnkcZq WK5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=N9RFaaUyKsxWingVv0Hbs7K3osgkOr8SsFI9Tp5Z20k=; b=tHVMlYgToo6mbn4gLsWal5JUTyOCSbKcnBbTkNDT32kLum2UsTdI8Y73tLympGYzrd Iw8tj/XXM4x5c+qaQvyyWwjsCurduOvS/unbGTc0pbk7XRK8c8LDmlc0ftwxuqK3JswW sgQJyNja48QuKdjnaUiAuyNJmiqFWBghlZty6eNtkryeMVR1hCBFBoDSDYB15oNk0BqR 6y8hhYaZYieareltgTaIqXI4Nbes/jQQMETdCndI/jbd1wIX/RswYYiQ2cWqSaXx0yki bc6Tt0PTR/HpkygnQ2Lo7dLzxmEf98GsZE2JpOOL7cQiZQkwgm+5SmvS0L7VVgrgekN7 D0ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pkUaCWUs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pg17si9009323ejb.288.2019.10.01.10.38.46; Tue, 01 Oct 2019 10:39:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pkUaCWUs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731209AbfJARhw (ORCPT + 99 others); Tue, 1 Oct 2019 13:37:52 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:54180 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731154AbfJARhw (ORCPT ); Tue, 1 Oct 2019 13:37:52 -0400 Received: by mail-pf1-f201.google.com with SMTP id x10so10756911pfr.20 for ; Tue, 01 Oct 2019 10:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=N9RFaaUyKsxWingVv0Hbs7K3osgkOr8SsFI9Tp5Z20k=; b=pkUaCWUsUNn5GOGIGsw9ewd3WuO5fY7ACvpKIOrqGyJIGOpRMoiSevDRoraYlU3g1E MRQok2xDgzcgI/rR/T5km2Yh4E9uF2eul+yE6YGP9ayIfhNL40yFgBmiJU0Vre7wkx/m J8bSPFKjN3JqL5FJ2V7Iqq7fL1qCfDYM6rXNgdNXU5/uekhj5e/DizKb7wzQtZhqvjgP +iRdatoeZwIjcN5DI5ClBFP7tc6oCcFI1Pws3TfQ3tBJEvM6iWD3qeWJCoMRUvSj2aqC Y1WKkR8aHva576d8/Yuys12+opTnZ4IJSPGffybI3W7ot7aQoZFS0AYOq1b73DtAPkVQ f+ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=N9RFaaUyKsxWingVv0Hbs7K3osgkOr8SsFI9Tp5Z20k=; b=LAiONaPRqfY+Ik0gJPyVZdwQZ7h26DIo4IaG4IZdN4M2EkvpgL5HuddsydlJ3412Ou dv0jojB629O0fd/eON22hY8rs2Z/kdOvddHp0T1tmsfz43zrenQBVKM2hetXZPP11Y7c 7259JYxfqyeCvWPFbktmRQVguTUbaJUU6hy35cFsETbWW539hhrVFMf8M2xodH2P+QUd 2Yg1EUbMmFgJ7Yvi4FIoASt6pyGe7O4/AVgQOw02HDX5duXZ8LCenLHRkO/bXtccVWgd frmDDBULVG29WNRAKAeM1nRaWC3GiTC2jc3AP6d11MIujmJbINiuoQI6f4p1+egB4KwX bZPg== X-Gm-Message-State: APjAAAVL/31MSqw9h80uemGVxWqQ/t6rO6vdAytzsMhWieY3c1nxRkM8 ZN1YrfscvrRkRYgTVqAEVfB8efO0Mk1u X-Received: by 2002:a63:d30f:: with SMTP id b15mr30940913pgg.341.1569951470992; Tue, 01 Oct 2019 10:37:50 -0700 (PDT) Date: Tue, 1 Oct 2019 10:37:27 -0700 In-Reply-To: <20191001173728.149786-1-brianvv@google.com> Message-Id: <20191001173728.149786-2-brianvv@google.com> Mime-Version: 1.0 References: <20191001173728.149786-1-brianvv@google.com> X-Mailer: git-send-email 2.23.0.444.g18eeb5a265-goog Subject: [PATCH bpf 1/2] selftests/bpf: test_progs: don't leak server_fd in tcp_rtt From: Brian Vazquez To: Brian Vazquez , Alexei Starovoitov , Daniel Borkmann , "David S . Miller" Cc: Stanislav Fomichev , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Brian Vazquez Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org server_fd needs to be closed if pthread can't be created. Fixes: 8a03222f508b ("selftests/bpf: test_progs: fix client/server race in tcp_rtt") Cc: Stanislav Fomichev Signed-off-by: Brian Vazquez --- tools/testing/selftests/bpf/prog_tests/tcp_rtt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c index a82da555b1b02..f4cd60d6fba2e 100644 --- a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c +++ b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c @@ -260,13 +260,14 @@ void test_tcp_rtt(void) if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread, (void *)&server_fd))) - goto close_cgroup_fd; + goto close_server_fd; pthread_mutex_lock(&server_started_mtx); pthread_cond_wait(&server_started, &server_started_mtx); pthread_mutex_unlock(&server_started_mtx); CHECK_FAIL(run_test(cgroup_fd, server_fd)); +close_server_fd: close(server_fd); close_cgroup_fd: close(cgroup_fd); -- 2.23.0.444.g18eeb5a265-goog