Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp484688rdb; Sat, 19 Aug 2023 09:29:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8Cayg2KWcdgSKA9T4unpox1BbNuo6fxnUfGAGDUtuCI8mi9AmEMQr+t6ruU663kPqYIdx X-Received: by 2002:a05:6a20:6a05:b0:137:3941:17b3 with SMTP id p5-20020a056a206a0500b00137394117b3mr3287412pzk.6.1692462586452; Sat, 19 Aug 2023 09:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692462586; cv=none; d=google.com; s=arc-20160816; b=vdSF1H9mY8wZD7SAUyNGwMfZpZIfb4u29XcheMpgnvp1oJwuLzHWw1xCu65GT9B1bH CvCYip7mNzGX47xt9zE9RBdckNtHaEIAKx/vvc+AZmBkz4YyR+Crrod0q+eFD84eKRUi TmC53HpqPpY8br0V/Z3DySeTTRPRksUCVrI82NvjbUX48G20Nuhmnng90eeQRQSg5bc1 ue6wagowWrUkSK+Xdo9oIXge5l1wFnhx1aeFqxWvjcOZn3X6MiYvCujK2vTFwfrK+SUw dDzd2pvmzxtWWMZDBdpo0t4EcaqRRVD6mCkf+cR81aq02R8GBr7zkLVeQWw35J3uZM6P QK3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=9Etvvr6DQxmfOnrEqIblmVTIKYltAAqaqsdln7KKBS8=; fh=AXczncXz4ElQeCHDy9A5Mvj6ttbLDsV9TdLAVqyRHN0=; b=GYM0Ib95/Mrb8rzAL3sSnN7F/67DLdFfwWm4p9yE8IApBxSG+k2PjCALLBCrusnhc9 N8RMScVo1TXaXf5RqlyeLVUta4HHcrSIqxjSNQFXOKelGhBXOe1/0YsT1KZfXLQd8PtC y7SLrrNyZHoa3JSnwqngv6/mei4HJXherIvZ4YMu5sJ1DWVsBjEb2ZrtdTZwi+a5np33 i/dIuei4IvEpF/esDla6geoSeb1Uj8c8xJs2wSPlkBuKHK60fNPgDTh8Wxk30ilZlz25 isGABEZef5jEtw+OxNZKpdL+g4nnE44pDlypi2wHdPfh8i4rpom6jLRu7xvsNy7NZkWg /bEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h130-20020a636c88000000b00565e93b3ab4si3420143pgc.136.2023.08.19.09.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 09:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 93D6D10E87D; Sat, 19 Aug 2023 01:51:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352973AbjHQPOl (ORCPT + 99 others); Thu, 17 Aug 2023 11:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353025AbjHQPOR (ORCPT ); Thu, 17 Aug 2023 11:14:17 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:237:300::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3C673590; Thu, 17 Aug 2023 08:14:10 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1qWegr-0002Mq-Sh; Thu, 17 Aug 2023 17:13:37 +0200 Date: Thu, 17 Aug 2023 17:13:37 +0200 From: Florian Westphal To: Lu Wei Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wsa+renesas@sang-engineering.com, tglx@linutronix.de, peterz@infradead.org, maheshb@google.com, fw@strlen.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] ipvlan: Fix a reference count leak warning in ipvlan_ns_exit() Message-ID: <20230817151337.GH4312@breakpoint.cc> References: <20230817145449.141827-1-luwei32@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230817145449.141827-1-luwei32@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,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 Lu Wei wrote: > There are two network devices(veth1 and veth3) in ns1, and ipvlan1 with > L3S mode and ipvlan2 with L2 mode are created based on them as > figure (1). In this case, ipvlan_register_nf_hook() will be called to > register nf hook which is needed by ipvlans in L3S mode in ns1 and value > of ipvl_nf_hook_refcnt is set to 1. [..] > register nf_hook in ns2 and unregister nf_hook in ns1. As a result, > ipvl_nf_hook_refcnt in ns1 is decreased incorrectly and this in ns2 > is increased incorrectly. When the second net namespace is removed, a > reference count leak warning in ipvlan_ns_exit() will be triggered. > > This patch add a check before ipvlan_migrate_l3s_hook() is called. Reviewed-by: Florian Westphal