Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31711197rwd; Fri, 7 Jul 2023 03:24:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHh9YPF47xdnxqNzLAqckoN6bHTu7oqUkqqK3gXlSHyygp5v9G3C0UKKEqmoUEK6GmHSwPH X-Received: by 2002:a05:6358:7f1e:b0:12b:e45b:3fac with SMTP id p30-20020a0563587f1e00b0012be45b3facmr5094150rwn.32.1688725441759; Fri, 07 Jul 2023 03:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688725441; cv=none; d=google.com; s=arc-20160816; b=qnW3+HS7QC1Y8ytgzFrprBHdWxLY/wC773f0B/HRkadyDn8+NpFi39Adla9VLXJtI1 YAD/MqCrRWhOPindDMayqZ17eB72X5s86vN1Lh5/WRb8ZG7Q5mP8cM9bPxQ3DbwO7bpx +jqLupqu2fWoqLDPbY8uHSsUnTEPsA3b0SkpMAdcm2gnAftxOjKau3lk3qFbaRh6URaF /bcWIfRdyQIAZkXKnpp5ag2cVZf79kleNsDQJrh72uxAuVgum/qjZ5GnKAIQ6yK3/Fyv 1xCNDE7+dW5+UNFGnGa8SdtiQC2JGqVefZOpq/XQ1F86C0+ikiijODtirQHvcby/F9um tihw== 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=sy2vDaiHDgQXse00i3mfQANU7pjI84Jd6Z514jbR4LM=; fh=3+mpC6JO+49cqmCdIxW91xOKuOpuG4pN4k0rUnHesOc=; b=KB+gcTQAnwRdsawAOOconlxo3oupbus8JZF/8TKyJi/5adRJ3vz0A9q0q4lTobBuVI AnBshNWg1G4hFj2mfoLEI5+1Q/mmgtixdeEFxa0ZV/XBGM6A25sSCml1+3pQN258bHky 5nlK7g7jaRc8izGWZcCIg5kEVJpFJoLgELGfysSpLcJmSqxuek0kmCD6j9QsqQJmui6f ao/BCVh3aciMO+ik3JCtkmo6KuW5vvtdLf7TJaVMwR8Vm9tYyeVICxrnrM762c5vO8Xp 5EDLoDifbg7pO75HBQrej+gi/VVNAKILppxAKaKyMILssSY6RokrEJHj09MLbZPvUX1I ifQg== 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j187-20020a638bc4000000b00542d3727da9si3659081pge.464.2023.07.07.03.23.47; Fri, 07 Jul 2023 03:24:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232728AbjGGKJp (ORCPT + 99 others); Fri, 7 Jul 2023 06:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbjGGKJn (ORCPT ); Fri, 7 Jul 2023 06:09:43 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:237:300::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D220A90; Fri, 7 Jul 2023 03:09:41 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1qHiP2-00033x-Dk; Fri, 07 Jul 2023 12:09:28 +0200 Date: Fri, 7 Jul 2023 12:09:28 +0200 From: Florian Westphal To: Daniel Xu Cc: pabeni@redhat.com, edumazet@google.com, kuba@kernel.org, fw@strlen.de, davem@davemloft.net, pablo@netfilter.org, kadlec@netfilter.org, dsahern@kernel.org, daniel@iogearbox.net, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH bpf-next v2 3/6] netfilter: bpf: Prevent defrag module unload while link active Message-ID: <20230707100928.GA11622@breakpoint.cc> References: <81ede90e3f1468763ea5b0b6ec2971b7b1b870c1.1688685338.git.dxu@dxuuu.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81ede90e3f1468763ea5b0b6ec2971b7b1b870c1.1688685338.git.dxu@dxuuu.xyz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Daniel Xu wrote: > + /* Prevent defrag module from going away while in use */ > + if (!try_module_get(v4_hook->owner)) { > + err = -ENOENT; > + goto out_v4; > + } > + > err = v4_hook->enable(link->net); > out_v4: > rcu_read_unlock(); > @@ -79,6 +86,12 @@ static int bpf_nf_enable_defrag(struct bpf_nf_link *link) > } > } > > + /* Prevent defrag module from going away while in use */ > + if (!try_module_get(v6_hook->owner)) { > + err = -ENOENT; > + goto out_v6; > + } > + > err = v6_hook->enable(link->net); > out_v6: > rcu_read_unlock(); This needs module_put() calls in case ->enable() returns an error, no? Other than this this series LGTM, thanks!