From patchwork Thu Jun 16 18:06:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Fijalkowski X-Patchwork-Id: 12884656 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 C20D4CCA480 for ; Thu, 16 Jun 2022 18:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359178AbiFPSGu (ORCPT ); Thu, 16 Jun 2022 14:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359126AbiFPSGg (ORCPT ); Thu, 16 Jun 2022 14:06:36 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F1CC4DF5E; Thu, 16 Jun 2022 11:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655402795; x=1686938795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GNXo+trQIlYOwd1aKpe01eUvic84o8Ql1koeEVmB18c=; b=agVzN1lAfsfIXbBeC3IlJpQYxMQZEr2mnq5cV0NB+sMMce8kN4WCjh8t s9kHKd0VheaZ/oHsXGTBNok62y4/ePnyoSWoUDxCHirwFwN9vCwTDKab4 rcIKiUYPXXmRPm1wVzQRRhtsTUk3wxVFKyLb4KozlnPiGClf5UtCBAzgy nuUuMXPUnCNlbHoPjYMi8Lb87xEb5pgBh8GQ64kzQuWmkFC6X+eHJhgFN /AyAzqCxv9IHox8EZO30E8jd8xJUDt55ob7mKljnyKZyIGBHa/ilxmfTe MEViOUDePQk27ydUuPzS5BeU4KWYsJM34gaIY5qDGvZAWHFdf7zB6cBCz g==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="343275940" X-IronPort-AV: E=Sophos;i="5.92,305,1650956400"; d="scan'208";a="343275940" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 11:06:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,305,1650956400"; d="scan'208";a="641664344" Received: from boxer.igk.intel.com ([10.102.20.173]) by fmsmga008.fm.intel.com with ESMTP; 16 Jun 2022 11:06:32 -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, kuba@kernel.org, Maciej Fijalkowski Subject: [PATCH v4 bpf-next 06/10] selftests: xsk: add missing close() on netns fd Date: Thu, 16 Jun 2022 20:06:05 +0200 Message-Id: <20220616180609.905015-7-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220616180609.905015-1-maciej.fijalkowski@intel.com> References: <20220616180609.905015-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);