aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /net/netfilter
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/x_tables.c6
-rw-r--r--net/netfilter/xt_hashlimit.c16
-rw-r--r--net/netfilter/xt_recent.c9
3 files changed, 18 insertions, 13 deletions
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 1a73b18683b6..8b03028cca69 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1000,7 +1000,7 @@ static int xt_table_open(struct inode *inode, struct file *file)
1000 sizeof(struct xt_names_priv)); 1000 sizeof(struct xt_names_priv));
1001 if (!ret) { 1001 if (!ret) {
1002 priv = ((struct seq_file *)file->private_data)->private; 1002 priv = ((struct seq_file *)file->private_data)->private;
1003 priv->af = (unsigned long)PDE(inode)->data; 1003 priv->af = (unsigned long)PDE_DATA(inode);
1004 } 1004 }
1005 return ret; 1005 return ret;
1006} 1006}
@@ -1148,7 +1148,7 @@ static int xt_match_open(struct inode *inode, struct file *file)
1148 1148
1149 seq = file->private_data; 1149 seq = file->private_data;
1150 seq->private = trav; 1150 seq->private = trav;
1151 trav->nfproto = (unsigned long)PDE(inode)->data; 1151 trav->nfproto = (unsigned long)PDE_DATA(inode);
1152 return 0; 1152 return 0;
1153} 1153}
1154 1154
@@ -1212,7 +1212,7 @@ static int xt_target_open(struct inode *inode, struct file *file)
1212 1212
1213 seq = file->private_data; 1213 seq = file->private_data;
1214 seq->private = trav; 1214 seq->private = trav;
1215 trav->nfproto = (unsigned long)PDE(inode)->data; 1215 trav->nfproto = (unsigned long)PDE_DATA(inode);
1216 return 0; 1216 return 0;
1217} 1217}
1218 1218
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 0199e7bb8f81..9ff035c71403 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -108,6 +108,7 @@ struct xt_hashlimit_htable {
108 108
109 /* seq_file stuff */ 109 /* seq_file stuff */
110 struct proc_dir_entry *pde; 110 struct proc_dir_entry *pde;
111 const char *name;
111 struct net *net; 112 struct net *net;
112 113
113 struct hlist_head hash[0]; /* hashtable itself */ 114 struct hlist_head hash[0]; /* hashtable itself */
@@ -254,6 +255,11 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
254 hinfo->count = 0; 255 hinfo->count = 0;
255 hinfo->family = family; 256 hinfo->family = family;
256 hinfo->rnd_initialized = false; 257 hinfo->rnd_initialized = false;
258 hinfo->name = kstrdup(minfo->name, GFP_KERNEL);
259 if (!hinfo->name) {
260 vfree(hinfo);
261 return -ENOMEM;
262 }
257 spin_lock_init(&hinfo->lock); 263 spin_lock_init(&hinfo->lock);
258 264
259 hinfo->pde = proc_create_data(minfo->name, 0, 265 hinfo->pde = proc_create_data(minfo->name, 0,
@@ -261,6 +267,7 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
261 hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit, 267 hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit,
262 &dl_file_ops, hinfo); 268 &dl_file_ops, hinfo);
263 if (hinfo->pde == NULL) { 269 if (hinfo->pde == NULL) {
270 kfree(hinfo->name);
264 vfree(hinfo); 271 vfree(hinfo);
265 return -ENOMEM; 272 return -ENOMEM;
266 } 273 }
@@ -331,9 +338,10 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
331 parent = hashlimit_net->ip6t_hashlimit; 338 parent = hashlimit_net->ip6t_hashlimit;
332 339
333 if(parent != NULL) 340 if(parent != NULL)
334 remove_proc_entry(hinfo->pde->name, parent); 341 remove_proc_entry(hinfo->name, parent);
335 342
336 htable_selective_cleanup(hinfo, select_all); 343 htable_selective_cleanup(hinfo, select_all);
344 kfree(hinfo->name);
337 vfree(hinfo); 345 vfree(hinfo);
338} 346}
339 347
@@ -345,7 +353,7 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net,
345 struct xt_hashlimit_htable *hinfo; 353 struct xt_hashlimit_htable *hinfo;
346 354
347 hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) { 355 hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) {
348 if (!strcmp(name, hinfo->pde->name) && 356 if (!strcmp(name, hinfo->name) &&
349 hinfo->family == family) { 357 hinfo->family == family) {
350 hinfo->use++; 358 hinfo->use++;
351 return hinfo; 359 return hinfo;
@@ -842,7 +850,7 @@ static int dl_proc_open(struct inode *inode, struct file *file)
842 850
843 if (!ret) { 851 if (!ret) {
844 struct seq_file *sf = file->private_data; 852 struct seq_file *sf = file->private_data;
845 sf->private = PDE(inode)->data; 853 sf->private = PDE_DATA(inode);
846 } 854 }
847 return ret; 855 return ret;
848} 856}
@@ -888,7 +896,7 @@ static void __net_exit hashlimit_proc_net_exit(struct net *net)
888 pde = hashlimit_net->ip6t_hashlimit; 896 pde = hashlimit_net->ip6t_hashlimit;
889 897
890 hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) 898 hlist_for_each_entry(hinfo, &hashlimit_net->htables, node)
891 remove_proc_entry(hinfo->pde->name, pde); 899 remove_proc_entry(hinfo->name, pde);
892 900
893 hashlimit_net->ipt_hashlimit = NULL; 901 hashlimit_net->ipt_hashlimit = NULL;
894 hashlimit_net->ip6t_hashlimit = NULL; 902 hashlimit_net->ip6t_hashlimit = NULL;
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index d9cad315229d..1e657cf715c4 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -401,8 +401,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
401 ret = -ENOMEM; 401 ret = -ENOMEM;
402 goto out; 402 goto out;
403 } 403 }
404 pde->uid = uid; 404 proc_set_user(pde, uid, gid);
405 pde->gid = gid;
406#endif 405#endif
407 spin_lock_bh(&recent_lock); 406 spin_lock_bh(&recent_lock);
408 list_add_tail(&t->list, &recent_net->tables); 407 list_add_tail(&t->list, &recent_net->tables);
@@ -525,14 +524,13 @@ static const struct seq_operations recent_seq_ops = {
525 524
526static int recent_seq_open(struct inode *inode, struct file *file) 525static int recent_seq_open(struct inode *inode, struct file *file)
527{ 526{
528 struct proc_dir_entry *pde = PDE(inode);
529 struct recent_iter_state *st; 527 struct recent_iter_state *st;
530 528
531 st = __seq_open_private(file, &recent_seq_ops, sizeof(*st)); 529 st = __seq_open_private(file, &recent_seq_ops, sizeof(*st));
532 if (st == NULL) 530 if (st == NULL)
533 return -ENOMEM; 531 return -ENOMEM;
534 532
535 st->table = pde->data; 533 st->table = PDE_DATA(inode);
536 return 0; 534 return 0;
537} 535}
538 536
@@ -540,8 +538,7 @@ static ssize_t
540recent_mt_proc_write(struct file *file, const char __user *input, 538recent_mt_proc_write(struct file *file, const char __user *input,
541 size_t size, loff_t *loff) 539 size_t size, loff_t *loff)
542{ 540{
543 const struct proc_dir_entry *pde = PDE(file_inode(file)); 541 struct recent_table *t = PDE_DATA(file_inode(file));
544 struct recent_table *t = pde->data;
545 struct recent_entry *e; 542 struct recent_entry *e;
546 char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; 543 char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")];
547 const char *c = buf; 544 const char *c = buf;