From patchwork Tue Aug 30 13:39: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: 12959383 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 9C3ACC0502C for ; Tue, 30 Aug 2022 13:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbiH3NtX (ORCPT ); Tue, 30 Aug 2022 09:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229874AbiH3Nsb (ORCPT ); Tue, 30 Aug 2022 09:48:31 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DC4510D4E2; Tue, 30 Aug 2022 06:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661867186; x=1693403186; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=er/Bc3XN5jHRYzy7lTmhugLOgFMGvSCPFonl4dxsKnk=; b=Xdt88dJFDa5UW3TKbXvqMfqgNmjzy8zvOUPENsSYpDswHyEYYdfJxhNs mOPzjC9bSbqG5bGN1OZfxD4Sgj66GfSc+VvexZwkOu28yd8DxfJvMmrGC ZnkanmA+MPyx8LtCNTiRubT5WzgO1CvfLp13NpWYeDcrx3nBZflubSxfn mqpmBRyoq6Laj1hPBBJMPoIAqNnWlaooOYydQ69gqi8S9ALzQ45IH6ft2 d7RcUV2YcD7HwOxXXSqmsgV+AkcoG3o8ZjYpx173F1Wqz44UK5LxWZ4S/ hSVTkUEXnvcQ58OZcY2fNg56cHmw/S7Zeqr8b97Y4wmd+jtqkoGBYqI60 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="295956716" X-IronPort-AV: E=Sophos;i="5.93,275,1654585200"; d="scan'208";a="295956716" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 06:39:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,275,1654585200"; d="scan'208";a="672868302" Received: from boxer.igk.intel.com ([10.102.20.173]) by fmsmga008.fm.intel.com with ESMTP; 30 Aug 2022 06:39:10 -0700 From: Maciej Fijalkowski To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com, bjorn@kernel.org, Maciej Fijalkowski Subject: [PATCH bpf] selftests: xsk: add missing close() on netns fd Date: Tue, 30 Aug 2022 15:39:05 +0200 Message-Id: <20220830133905.9945-1-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.35.3 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. Fixes: 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") Acked-by: Magnus Karlsson Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xskxceiver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 333cf23c01b5..d64652558d12 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1698,6 +1698,8 @@ static struct ifobject *ifobject_create(void) if (!ifobj->umem) goto out_umem; + ifobj->ns_fd = -1; + return ifobj; out_umem: @@ -1709,6 +1711,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);