mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
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>
This commit is contained in:
parent
77c5e3fdd2
commit
07919126ec
10 changed files with 34 additions and 32 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
#include <net/netfilter/nf_conntrack_expect.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,
|
enum ip_conntrack_info ctinfo,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
unsigned int matchoff,
|
unsigned int matchoff,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ struct nf_ct_ftp_master {
|
||||||
|
|
||||||
/* For NAT to hook in when we find a packet which describes what other
|
/* For NAT to hook in when we find a packet which describes what other
|
||||||
* connection we should expect. */
|
* connection we should expect. */
|
||||||
extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
|
extern unsigned int (__rcu *nf_nat_ftp_hook)(struct sk_buff *skb,
|
||||||
enum ip_conntrack_info ctinfo,
|
enum ip_conntrack_info ctinfo,
|
||||||
enum nf_ct_ftp_type type,
|
enum nf_ct_ftp_type type,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#define IRC_PORT 6667
|
#define IRC_PORT 6667
|
||||||
|
|
||||||
extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,
|
extern unsigned int (__rcu *nf_nat_irc_hook)(struct sk_buff *skb,
|
||||||
enum ip_conntrack_info ctinfo,
|
enum ip_conntrack_info ctinfo,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
unsigned int matchoff,
|
unsigned int matchoff,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <linux/netfilter.h>
|
#include <linux/netfilter.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
|
|
||||||
extern int (*nf_nat_snmp_hook)(struct sk_buff *skb,
|
extern int (__rcu *nf_nat_snmp_hook)(struct sk_buff *skb,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
struct nf_conn *ct,
|
struct nf_conn *ct,
|
||||||
enum ip_conntrack_info ctinfo);
|
enum ip_conntrack_info ctinfo);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ struct tftphdr {
|
||||||
#define TFTP_OPCODE_ACK 4
|
#define TFTP_OPCODE_ACK 4
|
||||||
#define TFTP_OPCODE_ERROR 5
|
#define TFTP_OPCODE_ERROR 5
|
||||||
|
|
||||||
extern unsigned int (*nf_nat_tftp_hook)(struct sk_buff *skb,
|
extern unsigned int (__rcu *nf_nat_tftp_hook)(struct sk_buff *skb,
|
||||||
enum ip_conntrack_info ctinfo,
|
enum ip_conntrack_info ctinfo,
|
||||||
struct nf_conntrack_expect *exp);
|
struct nf_conntrack_expect *exp);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ MODULE_PARM_DESC(master_timeout, "timeout for the master connection");
|
||||||
module_param(ts_algo, charp, 0400);
|
module_param(ts_algo, charp, 0400);
|
||||||
MODULE_PARM_DESC(ts_algo, "textsearch algorithm to use (default kmp)");
|
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,
|
enum ip_conntrack_info ctinfo,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
unsigned int matchoff,
|
unsigned int matchoff,
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ module_param_array(ports, ushort, &ports_c, 0400);
|
||||||
static bool loose;
|
static bool loose;
|
||||||
module_param(loose, bool, 0600);
|
module_param(loose, bool, 0600);
|
||||||
|
|
||||||
unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
|
unsigned int (__rcu *nf_nat_ftp_hook)(struct sk_buff *skb,
|
||||||
enum ip_conntrack_info ctinfo,
|
enum ip_conntrack_info ctinfo,
|
||||||
enum nf_ct_ftp_type type,
|
enum nf_ct_ftp_type type,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,13 @@ static unsigned int dcc_timeout __read_mostly = 300;
|
||||||
static char *irc_buffer;
|
static char *irc_buffer;
|
||||||
static DEFINE_SPINLOCK(irc_buffer_lock);
|
static DEFINE_SPINLOCK(irc_buffer_lock);
|
||||||
|
|
||||||
unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,
|
unsigned int (__rcu *nf_nat_irc_hook)(struct sk_buff *skb,
|
||||||
enum ip_conntrack_info ctinfo,
|
enum ip_conntrack_info ctinfo,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
unsigned int matchoff,
|
unsigned int matchoff,
|
||||||
unsigned int matchlen,
|
unsigned int matchlen,
|
||||||
struct nf_conntrack_expect *exp) __read_mostly;
|
struct nf_conntrack_expect *exp)
|
||||||
|
__read_mostly;
|
||||||
EXPORT_SYMBOL_GPL(nf_nat_irc_hook);
|
EXPORT_SYMBOL_GPL(nf_nat_irc_hook);
|
||||||
|
|
||||||
#define HELPER_NAME "irc"
|
#define HELPER_NAME "irc"
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ static unsigned int timeout __read_mostly = 30;
|
||||||
module_param(timeout, uint, 0400);
|
module_param(timeout, uint, 0400);
|
||||||
MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds");
|
MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds");
|
||||||
|
|
||||||
int (*nf_nat_snmp_hook)(struct sk_buff *skb,
|
int (__rcu *nf_nat_snmp_hook)(struct sk_buff *skb,
|
||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
struct nf_conn *ct,
|
struct nf_conn *ct,
|
||||||
enum ip_conntrack_info ctinfo);
|
enum ip_conntrack_info ctinfo);
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,10 @@ static unsigned int ports_c;
|
||||||
module_param_array(ports, ushort, &ports_c, 0400);
|
module_param_array(ports, ushort, &ports_c, 0400);
|
||||||
MODULE_PARM_DESC(ports, "Port numbers of TFTP servers");
|
MODULE_PARM_DESC(ports, "Port numbers of TFTP servers");
|
||||||
|
|
||||||
unsigned int (*nf_nat_tftp_hook)(struct sk_buff *skb,
|
unsigned int (__rcu *nf_nat_tftp_hook)(struct sk_buff *skb,
|
||||||
enum ip_conntrack_info ctinfo,
|
enum ip_conntrack_info ctinfo,
|
||||||
struct nf_conntrack_expect *exp) __read_mostly;
|
struct nf_conntrack_expect *exp)
|
||||||
|
__read_mostly;
|
||||||
EXPORT_SYMBOL_GPL(nf_nat_tftp_hook);
|
EXPORT_SYMBOL_GPL(nf_nat_tftp_hook);
|
||||||
|
|
||||||
static int tftp_help(struct sk_buff *skb,
|
static int tftp_help(struct sk_buff *skb,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue