[NETFILTER]: Replate direct proc_fops assignment with proc_create call.
This elliminates infamous race during module loading when one could lookup proc entry without proc_fops assigned. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
920fc941a9
commit
8eeee8b152
@@ -588,11 +588,9 @@ static int __init ip_queue_init(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net);
|
||||
if (proc) {
|
||||
proc->owner = THIS_MODULE;
|
||||
proc->proc_fops = &ip_queue_proc_fops;
|
||||
} else {
|
||||
proc = proc_create(IPQ_PROC_FS_NAME, 0, init_net.proc_net,
|
||||
&ip_queue_proc_fops);
|
||||
if (!proc) {
|
||||
printk(KERN_ERR "ip_queue: failed to create proc entry\n");
|
||||
goto cleanup_ipqnl;
|
||||
}
|
||||
|
@@ -167,14 +167,13 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
|
||||
|
||||
/* create proc dir entry */
|
||||
sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
|
||||
c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR,
|
||||
clusterip_procdir);
|
||||
c->pde = proc_create(buffer, S_IWUSR|S_IRUSR,
|
||||
clusterip_procdir, &clusterip_proc_fops);
|
||||
if (!c->pde) {
|
||||
kfree(c);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
c->pde->proc_fops = &clusterip_proc_fops;
|
||||
c->pde->data = c;
|
||||
#endif
|
||||
|
||||
|
@@ -276,12 +276,11 @@ recent_mt_check(const char *tablename, const void *ip,
|
||||
for (i = 0; i < ip_list_hash_size; i++)
|
||||
INIT_LIST_HEAD(&t->iphash[i]);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
t->proc = create_proc_entry(t->name, ip_list_perms, proc_dir);
|
||||
t->proc = proc_create(t->name, ip_list_perms, proc_dir, &recent_fops);
|
||||
if (t->proc == NULL) {
|
||||
kfree(t);
|
||||
goto out;
|
||||
}
|
||||
t->proc->proc_fops = &recent_fops;
|
||||
t->proc->uid = ip_list_uid;
|
||||
t->proc->gid = ip_list_gid;
|
||||
t->proc->data = t;
|
||||
|
@@ -395,13 +395,10 @@ int __init nf_conntrack_ipv4_compat_init(void)
|
||||
if (!proc_exp)
|
||||
goto err2;
|
||||
|
||||
proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, init_net.proc_net_stat);
|
||||
proc_stat = proc_create("ip_conntrack", S_IRUGO,
|
||||
init_net.proc_net_stat, &ct_cpu_seq_fops);
|
||||
if (!proc_stat)
|
||||
goto err3;
|
||||
|
||||
proc_stat->proc_fops = &ct_cpu_seq_fops;
|
||||
proc_stat->owner = THIS_MODULE;
|
||||
|
||||
return 0;
|
||||
|
||||
err3:
|
||||
|
Reference in New Issue
Block a user