]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
netfilter: use function typedefs for __rcu NAT helper hook pointers
authorSun Jian <sun.jian.kdev@gmail.com>
Tue, 3 Mar 2026 10:15:25 +0000 (18:15 +0800)
committerFlorian Westphal <fw@strlen.de>
Wed, 8 Apr 2026 05:51:26 +0000 (07:51 +0200)
commit6e6f2b9b3375cc0e6b8567d31ae7d3b2d910582f
tree719441491b7098bea316ae5def2ca8c96d3d214d
parentb3e69fc3196fc421e26196e7792f17b0463edc6f
netfilter: use function typedefs for __rcu NAT helper hook pointers

After commit 07919126ecfc ("netfilter: annotate NAT helper hook pointers
with __rcu"), sparse can warn about type/address-space mismatches when
RCU-dereferencing NAT helper hook function pointers.

The hooks are __rcu-annotated and accessed via rcu_dereference(), but the
combination of complex function pointer declarators and the WRITE_ONCE()
machinery used by RCU_INIT_POINTER()/rcu_assign_pointer() can confuse
sparse and trigger false positives.

Introduce typedefs for the NAT helper function types, so __rcu applies to
a simple "fn_t __rcu *" pointer form. Also replace local typeof(hook)
variables with "fn_t *" to avoid propagating __rcu address space into
temporaries.

No functional change intended.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603022359.3dGE9fwI-lkp@intel.com/
Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
include/linux/netfilter/nf_conntrack_amanda.h
include/linux/netfilter/nf_conntrack_ftp.h
include/linux/netfilter/nf_conntrack_irc.h
include/linux/netfilter/nf_conntrack_snmp.h
include/linux/netfilter/nf_conntrack_tftp.h
net/netfilter/nf_conntrack_amanda.c
net/netfilter/nf_conntrack_ftp.c
net/netfilter/nf_conntrack_irc.c
net/netfilter/nf_conntrack_snmp.c
net/netfilter/nf_conntrack_tftp.c