Subject: Re: [PATCH bpf-next v2 3/6] netfilter: bpf: Prevent defrag module unload while link active

From: Florian Westphal <[email-masked]>
Date: Fri, 7 Jul 2023 12:09:28 +0200

Daniel Xu <[email-masked]> 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!