[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABFUUZG87ia6AXbA=EWZb9uN=AzbBeH+gb_PDDOonJk-pyTPcQ@mail.gmail.com>
Date: Tue, 3 Feb 2026 22:36:25 +0800
From: sun jian <sun.jian.kdev@...il.com>
To: Florian Westphal <fw@...len.de>
Cc: Pablo Neira Ayuso <pablo@...filter.org>, Phil Sutter <phil@....cc>, Simon Horman <horms@...nel.org>,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] netfilter: amanda: fix RCU pointer typing for nf_nat_amanda_hook
On Tue, Feb 3, 2026 at 9:50 PM Florian Westphal <fw@...len.de> wrote:
>
> Sun Jian <sun.jian.kdev@...il.com> wrote:
> > 4. Using rcu_dereference_raw() to fetch the hook address, which
> > satisfies sparse's type checking for function pointers.
>
> This doesn't look right, esp. step 4. Why not:
>
> diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h
> --- a/include/linux/netfilter/nf_conntrack_amanda.h
> +++ b/include/linux/netfilter/nf_conntrack_amanda.h
> @@ -7,7 +7,7 @@
> #include <linux/skbuff.h>
> #include <net/netfilter/nf_conntrack_expect.h>
>
> -extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb,
> +extern unsigned int (__rcu *nf_nat_amanda_hook)(struct sk_buff *skb,
> enum ip_conntrack_info ctinfo,
> unsigned int protoff,
> unsigned int matchoff,
> diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntrack_amanda.c
> --- a/net/netfilter/nf_conntrack_amanda.c
> +++ b/net/netfilter/nf_conntrack_amanda.c
> @@ -37,7 +37,7 @@ MODULE_PARM_DESC(master_timeout, "timeout for the master connection");
> module_param(ts_algo, charp, 0400);
> MODULE_PARM_DESC(ts_algo, "textsearch algorithm to use (default kmp)");
>
> -unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb,
> +unsigned int (__rcu *nf_nat_amanda_hook)(struct sk_buff *skb,
> enum ip_conntrack_info ctinfo,
> unsigned int protoff,
> unsigned int matchoff,
> ?
Ack, I'll follow your suggestions and send a V2 shortly.
Thanks for the correction!
Regards,
Sun
Powered by blists - more mailing lists