From patchwork Tue Jun 14 17:47:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Fijalkowski X-Patchwork-Id: 12881327 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9484CCA47E for ; Tue, 14 Jun 2022 17:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344876AbiFNRsP (ORCPT ); Tue, 14 Jun 2022 13:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344698AbiFNRsO (ORCPT ); Tue, 14 Jun 2022 13:48:14 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA4E8338B7; Tue, 14 Jun 2022 10:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655228893; x=1686764893; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GNXo+trQIlYOwd1aKpe01eUvic84o8Ql1koeEVmB18c=; b=ZabQ51VUOsj+HY7yEllr3IswzPkJ4w9AkpNeJXKo9hRf6Jv+ki9SG+7+ 4GUA+A28YZOloH4w21pfNE7O30d0XKzgzPBb4NeBBETdS+buxweO1kJFv dE6GCIjiVW8764QFrluOV5+edfe8xrRi48eQjTLN7sO0Q/260ttzG3pEb j9xZqRHcngSee0raTqMEKIo9TrEVJHn8N4KOZdQt+nPLbwfQsmyO6p0HB 6+LqA5nmPlW8t0dYcry3lXTLFVoGf1O9HnGYppWr4Ap+baVXjH7PXBL3g UIwguvn8naLBQBixWguUtLaN7Oi5Y7F5aNbhLjVZUH6gtKP8iYJ/aA8CF Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="340356806" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="340356806" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 10:48:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="570110101" Received: from boxer.igk.intel.com ([10.102.20.173]) by orsmga002.jf.intel.com with ESMTP; 14 Jun 2022 10:48:02 -0700 From: Maciej Fijalkowski To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com, bjorn@kernel.org, Maciej Fijalkowski Subject: [PATCH v2 bpf-next 05/10] selftests: xsk: add missing close() on netns fd Date: Tue, 14 Jun 2022 19:47:44 +0200 Message-Id: <20220614174749.901044-6-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220614174749.901044-1-maciej.fijalkowski@intel.com> References: <20220614174749.901044-1-maciej.fijalkowski@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Commit 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") removed close on netns fd, which is not correct, so let us restore it. Acked-by: Magnus Karlsson Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c index a1e410f6a5d8..81ad69ed5839 100644 --- a/tools/testing/selftests/bpf/xdpxceiver.c +++ b/tools/testing/selftests/bpf/xdpxceiver.c @@ -1591,6 +1591,8 @@ static struct ifobject *ifobject_create(void) if (!ifobj->umem) goto out_umem; + ifobj->ns_fd = -1; + return ifobj; out_umem: @@ -1602,6 +1604,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);