All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xt_recent: use proc_create_data()
@ 2008-10-15  4:13 Alexey Dobriyan
  2008-10-16 13:12 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2008-10-15  4:13 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel

It's tiny little bit safer because ->data always appears initialized.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 net/netfilter/xt_recent.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -318,15 +318,15 @@ static bool recent_mt_check(const struct xt_mtchk_param *par)
 	for (i = 0; i < ip_list_hash_size; i++)
 		INIT_LIST_HEAD(&t->iphash[i]);
 #ifdef CONFIG_PROC_FS
-	t->proc = proc_create(t->name, ip_list_perms, recent_proc_dir,
-		  &recent_mt_fops);
+	t->proc = proc_create_data(t->name, ip_list_perms, recent_proc_dir,
+		  &recent_mt_fops, t);
 	if (t->proc == NULL) {
 		kfree(t);
 		goto out;
 	}
 #ifdef CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT
-	t->proc_old = proc_create(t->name, ip_list_perms, proc_old_dir,
-		      &recent_old_fops);
+	t->proc_old = proc_create_data(t->name, ip_list_perms, proc_old_dir,
+		      &recent_old_fops, t);
 	if (t->proc_old == NULL) {
 		remove_proc_entry(t->name, proc_old_dir);
 		kfree(t);
@@ -334,11 +334,9 @@ static bool recent_mt_check(const struct xt_mtchk_param *par)
 	}
 	t->proc_old->uid   = ip_list_uid;
 	t->proc_old->gid   = ip_list_gid;
-	t->proc_old->data  = t;
 #endif
 	t->proc->uid       = ip_list_uid;
 	t->proc->gid       = ip_list_gid;
-	t->proc->data      = t;
 #endif
 	spin_lock_bh(&recent_lock);
 	list_add_tail(&t->list, &tables);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-16 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-15  4:13 [PATCH 1/2] xt_recent: use proc_create_data() Alexey Dobriyan
2008-10-16 13:12 ` Patrick McHardy
2008-10-16 14:03   ` Alexey Dobriyan
2008-10-16 14:08     ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.