aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-03-27 19:55:53 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-27 19:55:53 -0400
commit8eeee8b152ae6bbe181518efaf62ba8e9c613693 (patch)
treeb5900762ddf2a5d03ed31da629b726c6fd6a710f /net/ipv4
parent920fc941a9617f95ccb283037fe6f8a38d95bb69 (diff)
[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>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/ip_queue.c8
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c5
-rw-r--r--net/ipv4/netfilter/ipt_recent.c3
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c7
4 files changed, 8 insertions, 15 deletions
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index fe05da41d6ba..4dc162894cb2 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -588,11 +588,9 @@ static int __init ip_queue_init(void)
588 } 588 }
589 589
590#ifdef CONFIG_PROC_FS 590#ifdef CONFIG_PROC_FS
591 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); 591 proc = proc_create(IPQ_PROC_FS_NAME, 0, init_net.proc_net,
592 if (proc) { 592 &ip_queue_proc_fops);
593 proc->owner = THIS_MODULE; 593 if (!proc) {
594 proc->proc_fops = &ip_queue_proc_fops;
595 } else {
596 printk(KERN_ERR "ip_queue: failed to create proc entry\n"); 594 printk(KERN_ERR "ip_queue: failed to create proc entry\n");
597 goto cleanup_ipqnl; 595 goto cleanup_ipqnl;
598 } 596 }
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index c6cf84c77611..52926c8e3cc1 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -167,14 +167,13 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
167 167
168 /* create proc dir entry */ 168 /* create proc dir entry */
169 sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); 169 sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
170 c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR, 170 c->pde = proc_create(buffer, S_IWUSR|S_IRUSR,
171 clusterip_procdir); 171 clusterip_procdir, &clusterip_proc_fops);
172 if (!c->pde) { 172 if (!c->pde) {
173 kfree(c); 173 kfree(c);
174 return NULL; 174 return NULL;
175 } 175 }
176 } 176 }
177 c->pde->proc_fops = &clusterip_proc_fops;
178 c->pde->data = c; 177 c->pde->data = c;
179#endif 178#endif
180 179
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 8e8f0425a8ed..50e06690eb5b 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -276,12 +276,11 @@ recent_mt_check(const char *tablename, const void *ip,
276 for (i = 0; i < ip_list_hash_size; i++) 276 for (i = 0; i < ip_list_hash_size; i++)
277 INIT_LIST_HEAD(&t->iphash[i]); 277 INIT_LIST_HEAD(&t->iphash[i]);
278#ifdef CONFIG_PROC_FS 278#ifdef CONFIG_PROC_FS
279 t->proc = create_proc_entry(t->name, ip_list_perms, proc_dir); 279 t->proc = proc_create(t->name, ip_list_perms, proc_dir, &recent_fops);
280 if (t->proc == NULL) { 280 if (t->proc == NULL) {
281 kfree(t); 281 kfree(t);
282 goto out; 282 goto out;
283 } 283 }
284 t->proc->proc_fops = &recent_fops;
285 t->proc->uid = ip_list_uid; 284 t->proc->uid = ip_list_uid;
286 t->proc->gid = ip_list_gid; 285 t->proc->gid = ip_list_gid;
287 t->proc->data = t; 286 t->proc->data = t;
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index 089252e82c01..f500b0fdaef4 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -395,13 +395,10 @@ int __init nf_conntrack_ipv4_compat_init(void)
395 if (!proc_exp) 395 if (!proc_exp)
396 goto err2; 396 goto err2;
397 397
398 proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, init_net.proc_net_stat); 398 proc_stat = proc_create("ip_conntrack", S_IRUGO,
399 init_net.proc_net_stat, &ct_cpu_seq_fops);
399 if (!proc_stat) 400 if (!proc_stat)
400 goto err3; 401 goto err3;
401
402 proc_stat->proc_fops = &ct_cpu_seq_fops;
403 proc_stat->owner = THIS_MODULE;
404
405 return 0; 402 return 0;
406 403
407err3: 404err3: