Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

netfilter: annotate NAT helper hook pointers with __rcu

The NAT helper hook pointers are updated and dereferenced under RCU rules,
but lack the proper __rcu annotation.

This makes sparse report address space mismatches when the hooks are used
with rcu_dereference().

Add the missing __rcu annotations to the global hook pointer declarations
and definitions in Amanda, FTP, IRC, SNMP and TFTP.

No functional change intended.

Suggested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>

authored by

Sun Jian and committed by
Florian Westphal
07919126 77c5e3fd

+34 -32
+1 -1
include/linux/netfilter/nf_conntrack_amanda.h
··· 7 7 #include <linux/skbuff.h> 8 8 #include <net/netfilter/nf_conntrack_expect.h> 9 9 10 - extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, 10 + extern unsigned int (__rcu *nf_nat_amanda_hook)(struct sk_buff *skb, 11 11 enum ip_conntrack_info ctinfo, 12 12 unsigned int protoff, 13 13 unsigned int matchoff,
+1 -1
include/linux/netfilter/nf_conntrack_ftp.h
··· 26 26 27 27 /* For NAT to hook in when we find a packet which describes what other 28 28 * connection we should expect. */ 29 - extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb, 29 + extern unsigned int (__rcu *nf_nat_ftp_hook)(struct sk_buff *skb, 30 30 enum ip_conntrack_info ctinfo, 31 31 enum nf_ct_ftp_type type, 32 32 unsigned int protoff,
+1 -1
include/linux/netfilter/nf_conntrack_irc.h
··· 8 8 9 9 #define IRC_PORT 6667 10 10 11 - extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb, 11 + extern unsigned int (__rcu *nf_nat_irc_hook)(struct sk_buff *skb, 12 12 enum ip_conntrack_info ctinfo, 13 13 unsigned int protoff, 14 14 unsigned int matchoff,
+1 -1
include/linux/netfilter/nf_conntrack_snmp.h
··· 5 5 #include <linux/netfilter.h> 6 6 #include <linux/skbuff.h> 7 7 8 - extern int (*nf_nat_snmp_hook)(struct sk_buff *skb, 8 + extern int (__rcu *nf_nat_snmp_hook)(struct sk_buff *skb, 9 9 unsigned int protoff, 10 10 struct nf_conn *ct, 11 11 enum ip_conntrack_info ctinfo);
+1 -1
include/linux/netfilter/nf_conntrack_tftp.h
··· 19 19 #define TFTP_OPCODE_ACK 4 20 20 #define TFTP_OPCODE_ERROR 5 21 21 22 - extern unsigned int (*nf_nat_tftp_hook)(struct sk_buff *skb, 22 + extern unsigned int (__rcu *nf_nat_tftp_hook)(struct sk_buff *skb, 23 23 enum ip_conntrack_info ctinfo, 24 24 struct nf_conntrack_expect *exp); 25 25
+7 -7
net/netfilter/nf_conntrack_amanda.c
··· 37 37 module_param(ts_algo, charp, 0400); 38 38 MODULE_PARM_DESC(ts_algo, "textsearch algorithm to use (default kmp)"); 39 39 40 - unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, 41 - enum ip_conntrack_info ctinfo, 42 - unsigned int protoff, 43 - unsigned int matchoff, 44 - unsigned int matchlen, 45 - struct nf_conntrack_expect *exp) 46 - __read_mostly; 40 + unsigned int (__rcu *nf_nat_amanda_hook)(struct sk_buff *skb, 41 + enum ip_conntrack_info ctinfo, 42 + unsigned int protoff, 43 + unsigned int matchoff, 44 + unsigned int matchlen, 45 + struct nf_conntrack_expect *exp) 46 + __read_mostly; 47 47 EXPORT_SYMBOL_GPL(nf_nat_amanda_hook); 48 48 49 49 enum amanda_strings {
+7 -7
net/netfilter/nf_conntrack_ftp.c
··· 43 43 static bool loose; 44 44 module_param(loose, bool, 0600); 45 45 46 - unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb, 47 - enum ip_conntrack_info ctinfo, 48 - enum nf_ct_ftp_type type, 49 - unsigned int protoff, 50 - unsigned int matchoff, 51 - unsigned int matchlen, 52 - struct nf_conntrack_expect *exp); 46 + unsigned int (__rcu *nf_nat_ftp_hook)(struct sk_buff *skb, 47 + enum ip_conntrack_info ctinfo, 48 + enum nf_ct_ftp_type type, 49 + unsigned int protoff, 50 + unsigned int matchoff, 51 + unsigned int matchlen, 52 + struct nf_conntrack_expect *exp); 53 53 EXPORT_SYMBOL_GPL(nf_nat_ftp_hook); 54 54 55 55 static int try_rfc959(const char *, size_t, struct nf_conntrack_man *,
+7 -6
net/netfilter/nf_conntrack_irc.c
··· 30 30 static char *irc_buffer; 31 31 static DEFINE_SPINLOCK(irc_buffer_lock); 32 32 33 - unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb, 34 - enum ip_conntrack_info ctinfo, 35 - unsigned int protoff, 36 - unsigned int matchoff, 37 - unsigned int matchlen, 38 - struct nf_conntrack_expect *exp) __read_mostly; 33 + unsigned int (__rcu *nf_nat_irc_hook)(struct sk_buff *skb, 34 + enum ip_conntrack_info ctinfo, 35 + unsigned int protoff, 36 + unsigned int matchoff, 37 + unsigned int matchlen, 38 + struct nf_conntrack_expect *exp) 39 + __read_mostly; 39 40 EXPORT_SYMBOL_GPL(nf_nat_irc_hook); 40 41 41 42 #define HELPER_NAME "irc"
+4 -4
net/netfilter/nf_conntrack_snmp.c
··· 25 25 module_param(timeout, uint, 0400); 26 26 MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds"); 27 27 28 - int (*nf_nat_snmp_hook)(struct sk_buff *skb, 29 - unsigned int protoff, 30 - struct nf_conn *ct, 31 - enum ip_conntrack_info ctinfo); 28 + int (__rcu *nf_nat_snmp_hook)(struct sk_buff *skb, 29 + unsigned int protoff, 30 + struct nf_conn *ct, 31 + enum ip_conntrack_info ctinfo); 32 32 EXPORT_SYMBOL_GPL(nf_nat_snmp_hook); 33 33 34 34 static int snmp_conntrack_help(struct sk_buff *skb, unsigned int protoff,
+4 -3
net/netfilter/nf_conntrack_tftp.c
··· 32 32 module_param_array(ports, ushort, &ports_c, 0400); 33 33 MODULE_PARM_DESC(ports, "Port numbers of TFTP servers"); 34 34 35 - unsigned int (*nf_nat_tftp_hook)(struct sk_buff *skb, 36 - enum ip_conntrack_info ctinfo, 37 - struct nf_conntrack_expect *exp) __read_mostly; 35 + unsigned int (__rcu *nf_nat_tftp_hook)(struct sk_buff *skb, 36 + enum ip_conntrack_info ctinfo, 37 + struct nf_conntrack_expect *exp) 38 + __read_mostly; 38 39 EXPORT_SYMBOL_GPL(nf_nat_tftp_hook); 39 40 40 41 static int tftp_help(struct sk_buff *skb,