From patchwork Wed Oct 19 08:25:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212187wrs; Wed, 19 Oct 2022 02:06:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40/VSbqnaXuTZv5oc8NZ1/kkhMUZ1YQ0L6pIXKwpGjqILai/WVItzgLXrgBnPfigUPIFwl X-Received: by 2002:a17:902:9a07:b0:178:8024:1393 with SMTP id v7-20020a1709029a0700b0017880241393mr7416754plp.128.1666170415352; Wed, 19 Oct 2022 02:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170415; cv=none; d=google.com; s=arc-20160816; b=PuymFUtjnrOCc7idCXvEQGDxJFinA/O81H9i/MtP2jcqI4On4dYJK/0VtwwzmDnVmN tyttR8K28xGiJHfajegvMLKPaoZpRvTdhQiTsQNN7HgHm4JbTfY5qLZuhgrSlNal/9lI Rx4/qDyIK6UZYbrEuYPzFySeq1BolNWgNDU7p9DCyy3dNc50qteAs2UuckZoNMUDd63H Y0UIbLcoNhyx7dIcMyFtwOjgL41f4OWik51w/JZcert5Wra8HT3+aCofU4doe12xoiAQ Y7pZf3NYUiFxvNnN3GIc8WiT0CNKxJXibppDMIUxh5dK5IttcTyhZaqsdRm1uWq11zCY tcFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EQcSow+UjqoK5meE5wgXzlQ4RTS2s3cYi2NfPAuFfzU=; b=J7BfifeOlvmXgn5BKXlPM5lfpC46da6P6mAxHLcM2rjnUIPcoMPIgUhPZET6aIl3MH 7psNAwaY6fOCkfyo04ni8Z0KE1/N5edLSifS4BmkYyTVol3TdF7k6chMuCLs0DmhInCj uPZqTa2jQSPzOJXpPWrByMxDYke6kLXh3mnjjPyTT0g53k37meRaoxGYbzKmDQFPPvwF /SWGjmaM/6vpk8tUGJVktwUn6JTrjTUzAzzqIoyFIBZpQRv0UHRLKEdURlt/j/UyoQDw 4ZXvLjGm/cWpjc9gwIpWXyfXp2SWbGZVOlfbejbwI/q46ftDDJq/KhL8+B59qpFYhRO0 9eXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=spyKqjnA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020a056a00081600b00557eeeb099csi18433895pfk.339.2022.10.19.02.06.35; Wed, 19 Oct 2022 02:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=spyKqjnA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbiJSIxw (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbiJSIxI (ORCPT ); Wed, 19 Oct 2022 04:53:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC8084E6D; Wed, 19 Oct 2022 01:50:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D19461847; Wed, 19 Oct 2022 08:49:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BFC1C433D6; Wed, 19 Oct 2022 08:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169373; bh=EQlopx31BUyrGQu0oSTme+DKanTOBlcrCtNgTG0TuYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spyKqjnAMoV7cSajhGgG0miGWeh5vw0bNnC/ztKfEV8jheLQOplUpaLdy+7xV574A 4+MseAQeZhGVAoOYNC2oL1MRr7hAlEyPlYL+f/aNd+2a0cZdz4/O3h+qTqvRQEIrgT KJN8BDhCjGjteGN1Ge6d8zmMf9Jo16z5teTbv5qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 6.0 252/862] selftests/xsk: Add missing close() on netns fd Date: Wed, 19 Oct 2022 10:25:39 +0200 Message-Id: <20221019083301.174955152@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106309407041581?= X-GMAIL-MSGID: =?utf-8?q?1747106309407041581?= From: Maciej Fijalkowski [ Upstream commit 8a7d61bdc2fac2c460a2f32a062f5c6dbd21a764 ] 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") Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220830133905.9945-1-maciej.fijalkowski@intel.com Signed-off-by: Sasha Levin --- 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 74d56d971baf..091402dc5390 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1606,6 +1606,8 @@ static struct ifobject *ifobject_create(void) if (!ifobj->umem) goto out_umem; + ifobj->ns_fd = -1; + return ifobj; out_umem: @@ -1617,6 +1619,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);