public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/12] Further PDE->data assignments cleanups
@ 2008-04-29 11:12 Denis V. Lunev
  2008-04-29 11:13 ` [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree Denis V. Lunev
                   ` (11 more replies)
  0 siblings, 12 replies; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

This set of patches replaces proc_create/etc and further PDE->data
assignment mostly with proc_data_create.

Signed-off-by: Denis V. Lunev <den@openvz.org>


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

* [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02  9:44   ` David Miller
  2008-04-29 11:13 ` [PATCH 2/12] netfilter: " Denis V. Lunev
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman

Simply replace proc_create and further data assigned with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---
 net/sunrpc/cache.c |   15 ++++++---------
 net/sunrpc/stats.c |    8 +-------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index d75530f..c996671 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -316,31 +316,28 @@ static int create_cache_proc_entries(struct cache_detail *cd)
 	cd->proc_ent->owner = cd->owner;
 	cd->channel_ent = cd->content_ent = NULL;
 
-	p = proc_create("flush", S_IFREG|S_IRUSR|S_IWUSR,
-			cd->proc_ent, &cache_flush_operations);
+	p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR,
+			     cd->proc_ent, &cache_flush_operations, cd);
 	cd->flush_ent = p;
 	if (p == NULL)
 		goto out_nomem;
 	p->owner = cd->owner;
-	p->data = cd;
 
 	if (cd->cache_request || cd->cache_parse) {
-		p = proc_create("channel", S_IFREG|S_IRUSR|S_IWUSR,
-				cd->proc_ent, &cache_file_operations);
+		p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR,
+				     cd->proc_ent, &cache_file_operations, cd);
 		cd->channel_ent = p;
 		if (p == NULL)
 			goto out_nomem;
 		p->owner = cd->owner;
-		p->data = cd;
 	}
 	if (cd->cache_show) {
-		p = proc_create("content", S_IFREG|S_IRUSR|S_IWUSR,
-				cd->proc_ent, &content_file_operations);
+		p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
+				cd->proc_ent, &content_file_operations, cd);
 		cd->content_ent = p;
 		if (p == NULL)
 			goto out_nomem;
 		p->owner = cd->owner;
-		p->data = cd;
 	}
 	return 0;
 out_nomem:
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index c6061a4..50b049c 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -224,16 +224,10 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats);
 static inline struct proc_dir_entry *
 do_register(const char *name, void *data, const struct file_operations *fops)
 {
-	struct proc_dir_entry *ent;
-
 	rpc_proc_init();
 	dprintk("RPC:       registering /proc/net/rpc/%s\n", name);
 
-	ent = proc_create(name, 0, proc_net_rpc, fops);
-	if (ent) {
-		ent->data = data;
-	}
-	return ent;
+	return proc_create_data(name, 0, proc_net_rpc, fops, data);
 }
 
 struct proc_dir_entry *
-- 
1.5.3.rc5


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

* [PATCH 2/12] netfilter: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
  2008-04-29 11:13 ` [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02  9:45   ` David Miller
  2008-04-29 11:13 ` [PATCH 3/12] net: " Denis V. Lunev
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Patrick McHardy

Simply replace proc_create and further data assigned with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Patrick McHardy <kaber@trash.net>
---
 net/ipv4/netfilter/ipt_CLUSTERIP.c |    6 +++---
 net/netfilter/xt_hashlimit.c       |   12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 22d8e7c..1819ad7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -169,14 +169,14 @@ clusterip_config_init(const struct ipt_clusterip_tgt_info *i, __be32 ip,
 
 		/* create proc dir entry */
 		sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
-		c->pde = proc_create(buffer, S_IWUSR|S_IRUSR,
-				     clusterip_procdir, &clusterip_proc_fops);
+		c->pde = proc_create_data(buffer, S_IWUSR|S_IRUSR,
+					  clusterip_procdir,
+					  &clusterip_proc_fops, c);
 		if (!c->pde) {
 			kfree(c);
 			return NULL;
 		}
 	}
-	c->pde->data = c;
 #endif
 
 	write_lock_bh(&clusterip_lock);
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 40d344b..6809af5 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -237,15 +237,15 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, int family)
 	hinfo->family = family;
 	hinfo->rnd_initialized = 0;
 	spin_lock_init(&hinfo->lock);
-	hinfo->pde = proc_create(minfo->name, 0,
+	hinfo->pde =
+		proc_create_data(minfo->name, 0,
 				 family == AF_INET ? hashlimit_procdir4 :
 						     hashlimit_procdir6,
-				 &dl_file_ops);
+				 &dl_file_ops, hinfo);
 	if (!hinfo->pde) {
 		vfree(hinfo);
 		return -1;
 	}
-	hinfo->pde->data = hinfo;
 
 	setup_timer(&hinfo->timer, htable_gc, (unsigned long )hinfo);
 	hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval);
@@ -301,15 +301,15 @@ static int htable_create(struct xt_hashlimit_mtinfo1 *minfo,
 	hinfo->rnd_initialized = 0;
 	spin_lock_init(&hinfo->lock);
 
-	hinfo->pde = proc_create(minfo->name, 0,
+	hinfo->pde =
+		proc_create_data(minfo->name, 0,
 				 family == AF_INET ? hashlimit_procdir4 :
 						     hashlimit_procdir6,
-				 &dl_file_ops);
+				 &dl_file_ops, hinfo);
 	if (hinfo->pde == NULL) {
 		vfree(hinfo);
 		return -1;
 	}
-	hinfo->pde->data = hinfo;
 
 	setup_timer(&hinfo->timer, htable_gc, (unsigned long)hinfo);
 	hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval);
-- 
1.5.3.rc5


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

* [PATCH 3/12] net: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
  2008-04-29 11:13 ` [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree Denis V. Lunev
  2008-04-29 11:13 ` [PATCH 2/12] netfilter: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02  9:46   ` David Miller
  2008-04-29 11:13 ` [PATCH 4/12] ipv6: " Denis V. Lunev
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	David S. Miller

Simply replace proc_create and further data assigned with proc_create_data.
Additionally, there is no need to assign NULL to PDE->data after creation,
/proc generic has already done this for us.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: David S. Miller <davem@davemloft.net>
---
 net/core/neighbour.c |    5 ++---
 net/core/pktgen.c    |   14 +++++---------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 75075c3..f4f9a63 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1430,11 +1430,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
 		panic("cannot create neighbour cache statistics");
 
 #ifdef CONFIG_PROC_FS
-	tbl->pde = proc_create(tbl->id, 0, init_net.proc_net_stat,
-			       &neigh_stat_seq_fops);
+	tbl->pde = proc_create_data(tbl->id, 0, init_net.proc_net_stat,
+				    &neigh_stat_seq_fops, tbl);
 	if (!tbl->pde)
 		panic("cannot create neighbour proc dir entry");
-	tbl->pde->data = tbl;
 #endif
 
 	tbl->hash_mask = 1;
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index a803b44..48a48c8 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3570,15 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
 	if (err)
 		goto out1;
 
-	pkt_dev->entry = proc_create(ifname, 0600,
-				     pg_proc_dir, &pktgen_if_fops);
+	pkt_dev->entry = proc_create_data(ifname, 0600, pg_proc_dir,
+					  &pktgen_if_fops, pkt_dev);
 	if (!pkt_dev->entry) {
 		printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
 		       PG_PROC_DIR, ifname);
 		err = -EINVAL;
 		goto out2;
 	}
-	pkt_dev->entry->data = pkt_dev;
 #ifdef CONFIG_XFRM
 	pkt_dev->ipsmode = XFRM_MODE_TRANSPORT;
 	pkt_dev->ipsproto = IPPROTO_ESP;
@@ -3628,7 +3627,8 @@ static int __init pktgen_create_thread(int cpu)
 	kthread_bind(p, cpu);
 	t->tsk = p;
 
-	pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops);
+	pe = proc_create_data(t->tsk->comm, 0600, pg_proc_dir,
+			      &pktgen_thread_fops, t);
 	if (!pe) {
 		printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
 		       PG_PROC_DIR, t->tsk->comm);
@@ -3638,8 +3638,6 @@ static int __init pktgen_create_thread(int cpu)
 		return -EINVAL;
 	}
 
-	pe->data = t;
-
 	wake_up_process(p);
 
 	return 0;
@@ -3716,8 +3714,6 @@ static int __init pg_init(void)
 		return -EINVAL;
 	}
 
-	pe->data = NULL;
-
 	/* Register us to receive netdevice events */
 	register_netdevice_notifier(&pktgen_notifier_block);
 
-- 
1.5.3.rc5


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

* [PATCH 4/12] ipv6: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (2 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 3/12] net: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02  9:47   ` David Miller
  2008-04-29 11:13 ` [PATCH 5/12] atm: " Denis V. Lunev
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Hideaki YOSHIFUJI

Simply replace proc_create and further data assigned with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
---
 net/ipv6/proc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index ca8b82f..df0736a 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -247,13 +247,11 @@ int snmp6_register_dev(struct inet6_dev *idev)
 	if (!proc_net_devsnmp6)
 		return -ENOENT;
 
-	p = proc_create(idev->dev->name, S_IRUGO,
-			proc_net_devsnmp6, &snmp6_seq_fops);
+	p = proc_create_data(idev->dev->name, S_IRUGO,
+			     proc_net_devsnmp6, &snmp6_seq_fops, idev);
 	if (!p)
 		return -ENOMEM;
 
-	p->data = idev;
-
 	idev->stats.proc_dir_entry = p;
 	return 0;
 }
-- 
1.5.3.rc5


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

* [PATCH 5/12] atm: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (3 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 4/12] ipv6: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02 11:08   ` David Miller
  2008-04-29 11:13 ` [PATCH 6/12] vlan: " Denis V. Lunev
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Chas Williams

Simply replace proc_create and further data assigned with proc_create_data.
proc_atm_dev_ops holds proper referrence.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
---
 net/atm/proc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/atm/proc.c b/net/atm/proc.c
index 5c9f3d1..49487b3 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -417,12 +417,10 @@ int atm_proc_dev_register(struct atm_dev *dev)
 		goto err_out;
 	sprintf(dev->proc_name,"%s:%d",dev->type, dev->number);
 
-	dev->proc_entry = proc_create(dev->proc_name, 0, atm_proc_root,
-				      &proc_atm_dev_ops);
+	dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root,
+					   &proc_atm_dev_ops, dev);
 	if (!dev->proc_entry)
 		goto err_free_name;
-	dev->proc_entry->data = dev;
-	dev->proc_entry->owner = THIS_MODULE;
 	return 0;
 err_free_name:
 	kfree(dev->proc_name);
-- 
1.5.3.rc5


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

* [PATCH 6/12] vlan: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (4 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 5/12] atm: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02 11:09   ` David Miller
  2008-04-29 11:13 ` [PATCH 7/12] cciss: " Denis V. Lunev
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Patrick McHardy

Simply replace proc_create and further data assigned with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Patrick McHardy <kaber@trash.net>
---
 net/8021q/vlanproc.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index daad006..08b54b5 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -176,12 +176,11 @@ int vlan_proc_add_dev(struct net_device *vlandev)
 	struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
 	struct vlan_net *vn = net_generic(dev_net(vlandev), vlan_net_id);
 
-	dev_info->dent = proc_create(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR,
-				     vn->proc_vlan_dir, &vlandev_fops);
+	dev_info->dent =
+		proc_create_data(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR,
+				 vn->proc_vlan_dir, &vlandev_fops, vlandev);
 	if (!dev_info->dent)
 		return -ENOBUFS;
-
-	dev_info->dent->data = vlandev;
 	return 0;
 }
 
-- 
1.5.3.rc5


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

* [PATCH 7/12] cciss: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (5 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 6/12] vlan: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-04-29 15:26   ` Miller, Mike (OS Dev)
  2008-04-29 11:13 ` [PATCH 8/12] powerpc: " Denis V. Lunev
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	iss_storagedev, Greg Kroah-Hartman

Simply replace proc_create and further data assigned with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: <iss_storagedev@hp.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/block/cciss.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index e539be5..e336b05 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -428,13 +428,9 @@ static void __devinit cciss_procinit(int i)
 		proc_cciss = proc_mkdir("driver/cciss", NULL);
 	if (!proc_cciss)
 		return;
-	pde = proc_create(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP |
+	pde = proc_create_data(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP |
 					S_IROTH, proc_cciss,
-					&cciss_proc_fops);
-	if (!pde)
-		return;
-
-	pde->data = hba[i];
+					&cciss_proc_fops, hba[i]);
 }
 #endif				/* CONFIG_PROC_FS */
 
-- 
1.5.3.rc5


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

* [PATCH 8/12] powerpc: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (6 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 7/12] cciss: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-04-29 11:13 ` [PATCH 9/12] ipv4: " Denis V. Lunev
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Paul Mackerras

Simply replace proc_create and further data assigned with proc_create_data.
No need to check for data!=NULL after that.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Paul Mackerras <paulus@au.ibm.com>
---
 arch/powerpc/platforms/pseries/scanlog.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index e5b0ea8..7a76f63 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -57,11 +57,6 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
         dp = PDE(inode);
  	data = (unsigned int *)dp->data;
 
-	if (!data) {
-		printk(KERN_ERR "scanlog: read failed no data\n");
-		return -EIO;
-	}
-
 	if (count > RTAS_DATA_BUF_SIZE)
 		count = RTAS_DATA_BUF_SIZE;
 
@@ -153,11 +148,6 @@ static int scanlog_open(struct inode * inode, struct file * file)
 	struct proc_dir_entry *dp = PDE(inode);
 	unsigned int *data = (unsigned int *)dp->data;
 
-	if (!data) {
-		printk(KERN_ERR "scanlog: open failed no data\n");
-		return -EIO;
-	}
-
 	if (data[0] != 0) {
 		/* This imperfect test stops a second copy of the
 		 * data (or a reset while data is being copied)
@@ -175,10 +165,6 @@ static int scanlog_release(struct inode * inode, struct file * file)
 	struct proc_dir_entry *dp = PDE(inode);
 	unsigned int *data = (unsigned int *)dp->data;
 
-	if (!data) {
-		printk(KERN_ERR "scanlog: release failed no data\n");
-		return -EIO;
-	}
 	data[0] = 0;
 
 	return 0;
@@ -207,12 +193,11 @@ static int __init scanlog_init(void)
 	if (!data)
 		goto err;
 
-	ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL,
-			  &scanlog_fops);
+	ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL,
+			       &scanlog_fops, data);
 	if (!ent)
 		goto err;
 
-	ent->data = data;
 	proc_ppc64_scan_log_dump = ent;
 
 	return 0;
-- 
1.5.3.rc5


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

* [PATCH 9/12] ipv4: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (7 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 8/12] powerpc: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02 11:10   ` David Miller
  2008-07-12  3:12   ` Stoyan Gaydarov
  2008-04-29 11:13 ` [PATCH 10/12] netfilter: assign PDE->fops " Denis V. Lunev
                   ` (2 subsequent siblings)
  11 siblings, 2 replies; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	David S. Miller

The check for PDE->data != NULL becomes useless after the replacement
of proc_net_fops_create with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: David S. Miller <davem@davemloft.net>
---
 net/ipv4/tcp_ipv4.c |   10 +++-------
 net/ipv4/udp.c      |    7 +++----
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 7766151..4d97b28 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2214,9 +2214,6 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
 	struct tcp_iter_state *s;
 	int err;
 
-	if (unlikely(afinfo == NULL))
-		return -EINVAL;
-
 	err = seq_open_net(inode, file, &afinfo->seq_ops,
 			  sizeof(struct tcp_iter_state));
 	if (err < 0)
@@ -2241,10 +2238,9 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
 	afinfo->seq_ops.next		= tcp_seq_next;
 	afinfo->seq_ops.stop		= tcp_seq_stop;
 
-	p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops);
-	if (p)
-		p->data = afinfo;
-	else
+	p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
+			     &afinfo->seq_fops, afinfo);
+	if (!p)
 		rc = -ENOMEM;
 	return rc;
 }
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b053ac7..c19c491 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1605,10 +1605,9 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
 	afinfo->seq_ops.next		= udp_seq_next;
 	afinfo->seq_ops.stop		= udp_seq_stop;
 
-	p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops);
-	if (p)
-		p->data = afinfo;
-	else
+	p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
+			     &afinfo->seq_fops, afinfo);
+	if (!p)
 		rc = -ENOMEM;
 	return rc;
 }
-- 
1.5.3.rc5


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

* [PATCH 10/12] netfilter: assign PDE->fops before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (8 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 9/12] ipv4: " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02 11:11   ` David Miller
  2008-04-29 11:13 ` [PATCH 11/12] netfilter: assign PDE->data " Denis V. Lunev
  2008-04-29 11:13 ` [PATCH 12/12] netns: assign PDE->data before gluing entry " Denis V. Lunev
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Patrick McHardy

Replace create_proc_entry with specially created for this purpose proc_create.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/nf_conntrack_standalone.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index b59871f..46ea542 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -296,11 +296,11 @@ static int nf_conntrack_standalone_init_proc(void)
 	pde = proc_net_fops_create(&init_net, "nf_conntrack", 0440, &ct_file_ops);
 	if (!pde)
 		goto out_nf_conntrack;
-	pde = create_proc_entry("nf_conntrack", S_IRUGO, init_net.proc_net_stat);
+
+	pde = proc_create("nf_conntrack", S_IRUGO, init_net.proc_net_stat,
+			  &ct_cpu_seq_fops);
 	if (!pde)
 		goto out_stat_nf_conntrack;
-	pde->proc_fops = &ct_cpu_seq_fops;
-	pde->owner = THIS_MODULE;
 	return 0;
 
 out_stat_nf_conntrack:
-- 
1.5.3.rc5


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

* [PATCH 11/12] netfilter: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (9 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 10/12] netfilter: assign PDE->fops " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-04-29 12:01   ` Patrick McHardy
  2008-05-02 11:12   ` David Miller
  2008-04-29 11:13 ` [PATCH 12/12] netns: assign PDE->data before gluing entry " Denis V. Lunev
  11 siblings, 2 replies; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman,
	Patrick McHardy

Replace proc_net_fops_create with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/x_tables.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index f52f7f8..c3aa45b 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -936,25 +936,24 @@ int xt_proto_init(struct net *net, int af)
 #ifdef CONFIG_PROC_FS
 	strlcpy(buf, xt_prefix[af], sizeof(buf));
 	strlcat(buf, FORMAT_TABLES, sizeof(buf));
-	proc = proc_net_fops_create(net, buf, 0440, &xt_table_ops);
+	proc = proc_create_data(buf, 0440, net->proc_net, &xt_table_ops,
+				(void *)(unsigned long)af);
 	if (!proc)
 		goto out;
-	proc->data = (void *)(unsigned long)af;
-
 
 	strlcpy(buf, xt_prefix[af], sizeof(buf));
 	strlcat(buf, FORMAT_MATCHES, sizeof(buf));
-	proc = proc_net_fops_create(net, buf, 0440, &xt_match_ops);
+	proc = proc_create_data(buf, 0440, net->proc_net, &xt_match_ops,
+				(void *)(unsigned long)af);
 	if (!proc)
 		goto out_remove_tables;
-	proc->data = (void *)(unsigned long)af;
 
 	strlcpy(buf, xt_prefix[af], sizeof(buf));
 	strlcat(buf, FORMAT_TARGETS, sizeof(buf));
-	proc = proc_net_fops_create(net, buf, 0440, &xt_target_ops);
+	proc = proc_create_data(buf, 0440, net->proc_net, &xt_target_ops,
+				(void *)(unsigned long)af);
 	if (!proc)
 		goto out_remove_matches;
-	proc->data = (void *)(unsigned long)af;
 #endif
 
 	return 0;
-- 
1.5.3.rc5


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

* [PATCH 12/12] netns: assign PDE->data before gluing entry into /proc tree
  2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
                   ` (10 preceding siblings ...)
  2008-04-29 11:13 ` [PATCH 11/12] netfilter: assign PDE->data " Denis V. Lunev
@ 2008-04-29 11:13 ` Denis V. Lunev
  2008-05-02 11:12   ` David Miller
  11 siblings, 1 reply; 28+ messages in thread
From: Denis V. Lunev @ 2008-04-29 11:13 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Denis V. Lunev, Alexey Dobriyan, Eric W. Biederman

In this unfortunate case, proc_mkdir_mode wrapper can't be used anymore and
this is no way to reuse proc_create_data due to nlinks assignment. So,
copy the code from proc_mkdir and assign PDE->data at the appropriate
moment.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/proc/generic.c  |   17 +++++++++++++++++
 fs/proc/proc_net.c |   11 -----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 9d53b39..43e54e8 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -641,6 +641,23 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode,
 	return ent;
 }
 
+struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
+		struct proc_dir_entry *parent)
+{
+	struct proc_dir_entry *ent;
+
+	ent = __proc_create(&parent, name, S_IFDIR | S_IRUGO | S_IXUGO, 2);
+	if (ent) {
+		ent->data = net;
+		if (proc_register(parent, ent) < 0) {
+			kfree(ent);
+			ent = NULL;
+		}
+	}
+	return ent;
+}
+EXPORT_SYMBOL_GPL(proc_net_mkdir);
+
 struct proc_dir_entry *proc_mkdir(const char *name,
 		struct proc_dir_entry *parent)
 {
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 13cd783..83f357b 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -159,17 +159,6 @@ struct net *get_proc_net(const struct inode *inode)
 }
 EXPORT_SYMBOL_GPL(get_proc_net);
 
-struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
-		struct proc_dir_entry *parent)
-{
-	struct proc_dir_entry *pde;
-	pde = proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent);
-	if (pde != NULL)
-		pde->data = net;
-	return pde;
-}
-EXPORT_SYMBOL_GPL(proc_net_mkdir);
-
 static __net_init int proc_net_ns_init(struct net *net)
 {
 	struct proc_dir_entry *netd, *net_statd;
-- 
1.5.3.rc5


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

* Re: [PATCH 11/12] netfilter: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 11/12] netfilter: assign PDE->data " Denis V. Lunev
@ 2008-04-29 12:01   ` Patrick McHardy
  2008-05-02 11:12   ` David Miller
  1 sibling, 0 replies; 28+ messages in thread
From: Patrick McHardy @ 2008-04-29 12:01 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: akpm, linux-kernel, Alexey Dobriyan, Eric W. Biederman

Denis V. Lunev wrote:
> Replace proc_net_fops_create with proc_create_data.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Patrick McHardy <kaber@trash.net>

For the VLAN and netfilter patches:

Acked-by: Patrick McHardy <kaber@trash.net>


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

* RE: [PATCH 7/12] cciss: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 7/12] cciss: " Denis V. Lunev
@ 2008-04-29 15:26   ` Miller, Mike (OS Dev)
  0 siblings, 0 replies; 28+ messages in thread
From: Miller, Mike (OS Dev) @ 2008-04-29 15:26 UTC (permalink / raw)
  To: Denis V. Lunev, akpm@linux-foundation.org
  Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan, Eric W. Biederman,
	ISS StorageDev, Greg Kroah-Hartman



> -----Original Message-----
> From: den@sw.ru [mailto:den@sw.ru] On Behalf Of Denis V. Lunev
> Sent: Tuesday, April 29, 2008 6:13 AM
> To: akpm@linux-foundation.org
> Cc: linux-kernel@vger.kernel.org; Denis V. Lunev; Alexey
> Dobriyan; Eric W. Biederman; ISS StorageDev; Greg Kroah-Hartman
> Subject: [PATCH 7/12] cciss: assign PDE->data before gluing
> PDE into /proc tree
>
> Simply replace proc_create and further data assigned with
> proc_create_data.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: <iss_storagedev@hp.com>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>

Acked-by: Mike Miller <mike.miller@hp.com>

> ---
>  drivers/block/cciss.c |    8 ++------
>  1 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index e539be5..e336b05 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -428,13 +428,9 @@ static void __devinit cciss_procinit(int i)
>                 proc_cciss = proc_mkdir("driver/cciss", NULL);
>         if (!proc_cciss)
>                 return;
> -       pde = proc_create(hba[i]->devname, S_IWUSR | S_IRUSR
> | S_IRGRP |
> +       pde = proc_create_data(hba[i]->devname, S_IWUSR | S_IRUSR |
> + S_IRGRP |
>                                         S_IROTH, proc_cciss,
> -                                       &cciss_proc_fops);
> -       if (!pde)
> -               return;
> -
> -       pde->data = hba[i];
> +                                       &cciss_proc_fops, hba[i]);
>  }
>  #endif                         /* CONFIG_PROC_FS */
>
> --
> 1.5.3.rc5
>
>

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

* Re: [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree Denis V. Lunev
@ 2008-05-02  9:44   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02  9:44 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:11 +0400

> Simply replace proc_create and further data assigned with proc_create_data.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Applied.

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

* Re: [PATCH 2/12] netfilter: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 2/12] netfilter: " Denis V. Lunev
@ 2008-05-02  9:45   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02  9:45 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm, kaber

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:12 +0400

> Simply replace proc_create and further data assigned with proc_create_data.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Patrick McHardy <kaber@trash.net>

Applied, with Patrick's ACK.

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

* Re: [PATCH 3/12] net: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 3/12] net: " Denis V. Lunev
@ 2008-05-02  9:46   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02  9:46 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:13 +0400

> Simply replace proc_create and further data assigned with proc_create_data.
> Additionally, there is no need to assign NULL to PDE->data after creation,
> /proc generic has already done this for us.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Applied, thanks.

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

* Re: [PATCH 4/12] ipv6: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 4/12] ipv6: " Denis V. Lunev
@ 2008-05-02  9:47   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02  9:47 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm, yoshfuji

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:14 +0400

> Simply replace proc_create and further data assigned with proc_create_data.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Applied, thanks.

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

* Re: [PATCH 5/12] atm: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 5/12] atm: " Denis V. Lunev
@ 2008-05-02 11:08   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02 11:08 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm, chas

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:15 +0400

> Simply replace proc_create and further data assigned with proc_create_data.
> proc_atm_dev_ops holds proper referrence.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Applied.

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

* Re: [PATCH 6/12] vlan: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 6/12] vlan: " Denis V. Lunev
@ 2008-05-02 11:09   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02 11:09 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm, kaber

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:16 +0400

> Simply replace proc_create and further data assigned with proc_create_data.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Patrick McHardy <kaber@trash.net>

Applied, with Patrick's ACK.

Thanks.

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

* Re: [PATCH 9/12] ipv4: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 9/12] ipv4: " Denis V. Lunev
@ 2008-05-02 11:10   ` David Miller
  2008-07-12  3:12   ` Stoyan Gaydarov
  1 sibling, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02 11:10 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:19 +0400

> The check for PDE->data != NULL becomes useless after the replacement
> of proc_net_fops_create with proc_create_data.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Applied.

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

* Re: [PATCH 10/12] netfilter: assign PDE->fops before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 10/12] netfilter: assign PDE->fops " Denis V. Lunev
@ 2008-05-02 11:11   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02 11:11 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm, kaber

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:20 +0400

> Replace create_proc_entry with specially created for this purpose proc_create.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Patrick McHardy <kaber@trash.net>

Applied, with Patrick's ACK.

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

* Re: [PATCH 11/12] netfilter: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 11/12] netfilter: assign PDE->data " Denis V. Lunev
  2008-04-29 12:01   ` Patrick McHardy
@ 2008-05-02 11:12   ` David Miller
  1 sibling, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02 11:12 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm, kaber

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:21 +0400

> Replace proc_net_fops_create with proc_create_data.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Patrick McHardy <kaber@trash.net>

Applied, with Patrick's ACK.

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

* Re: [PATCH 12/12] netns: assign PDE->data before gluing entry into /proc tree
  2008-04-29 11:13 ` [PATCH 12/12] netns: assign PDE->data before gluing entry " Denis V. Lunev
@ 2008-05-02 11:12   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2008-05-02 11:12 UTC (permalink / raw)
  To: den; +Cc: akpm, linux-kernel, adobriyan, ebiederm

From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 29 Apr 2008 15:13:22 +0400

> In this unfortunate case, proc_mkdir_mode wrapper can't be used anymore and
> this is no way to reuse proc_create_data due to nlinks assignment. So,
> copy the code from proc_mkdir and assign PDE->data at the appropriate
> moment.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Oh well, the cost of correctness sometimes :-)

Applied, thanks.

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

* Re: [PATCH 9/12] ipv4: assign PDE->data before gluing PDE into /proc tree
  2008-04-29 11:13 ` [PATCH 9/12] ipv4: " Denis V. Lunev
  2008-05-02 11:10   ` David Miller
@ 2008-07-12  3:12   ` Stoyan Gaydarov
  2008-07-12  3:42     ` Eric W. Biederman
  2008-07-12 14:55     ` Denis V. Lunev
  1 sibling, 2 replies; 28+ messages in thread
From: Stoyan Gaydarov @ 2008-07-12  3:12 UTC (permalink / raw)
  To: Denis V. Lunev
  Cc: akpm, linux-kernel, Alexey Dobriyan, Eric W. Biederman,
	David S. Miller

First off, sorry to bring such an old email back but I can seem to get
a bad feeling when looking back over it.

On Tue, Apr 29, 2008 at 6:13 AM, Denis V. Lunev <den@openvz.org> wrote:
> The check for PDE->data != NULL becomes useless after the replacement
> of proc_net_fops_create with proc_create_data.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Alexey Dobriyan <adobriyan@openvz.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  net/ipv4/tcp_ipv4.c |   10 +++-------
>  net/ipv4/udp.c      |    7 +++----
>  2 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 7766151..4d97b28 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -2214,9 +2214,6 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
>        struct tcp_iter_state *s;
>        int err;
>
> -       if (unlikely(afinfo == NULL))
> -               return -EINVAL;
I think that this check needs to stay in some form, reason below.
> -
>        err = seq_open_net(inode, file, &afinfo->seq_ops,
>                          sizeof(struct tcp_iter_state));
>        if (err < 0)
> @@ -2241,10 +2238,9 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
>        afinfo->seq_ops.next            = tcp_seq_next;
>        afinfo->seq_ops.stop            = tcp_seq_stop;
>
> -       p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops);
> -       if (p)
> -               p->data = afinfo;
> -       else
> +       p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,

When you try to pass in afinfo->name (and also the seq_fops) you are
assuming that afinfo is not null meaning in the unlikely(as shown
above) even that it is null you get a very bad null pointer problem.
If I am just way off do let me know because this just seams to me like
a bad idea. This is also still present in 2.6.26-rc9.

-Stoyan G

> +                            &afinfo->seq_fops, afinfo);
> +       if (!p)
>                rc = -ENOMEM;
>        return rc;
>  }
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index b053ac7..c19c491 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1605,10 +1605,9 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
>        afinfo->seq_ops.next            = udp_seq_next;
>        afinfo->seq_ops.stop            = udp_seq_stop;
>
> -       p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops);
> -       if (p)
> -               p->data = afinfo;
> -       else
> +       p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
> +                            &afinfo->seq_fops, afinfo);
> +       if (!p)
>                rc = -ENOMEM;
>        return rc;
>  }
> --
> 1.5.3.rc5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

* Re: [PATCH 9/12] ipv4: assign PDE->data before gluing PDE into /proc tree
  2008-07-12  3:12   ` Stoyan Gaydarov
@ 2008-07-12  3:42     ` Eric W. Biederman
  2008-07-12 14:55     ` Denis V. Lunev
  1 sibling, 0 replies; 28+ messages in thread
From: Eric W. Biederman @ 2008-07-12  3:42 UTC (permalink / raw)
  To: Stoyan Gaydarov
  Cc: Denis V. Lunev, akpm, linux-kernel, Alexey Dobriyan,
	Eric W. Biederman, David S. Miller

"Stoyan Gaydarov" <stoyboyker@gmail.com> writes:

> First off, sorry to bring such an old email back but I can seem to get
> a bad feeling when looking back over it.
>
> On Tue, Apr 29, 2008 at 6:13 AM, Denis V. Lunev <den@openvz.org> wrote:
>> The check for PDE->data != NULL becomes useless after the replacement
>> of proc_net_fops_create with proc_create_data.
>>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> Cc: Alexey Dobriyan <adobriyan@openvz.org>
>> Cc: Eric W. Biederman <ebiederm@xmission.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> ---
>>  net/ipv4/tcp_ipv4.c |   10 +++-------
>>  net/ipv4/udp.c      |    7 +++----
>>  2 files changed, 6 insertions(+), 11 deletions(-)
>>
>> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
>> index 7766151..4d97b28 100644
>> --- a/net/ipv4/tcp_ipv4.c
>> +++ b/net/ipv4/tcp_ipv4.c
>> @@ -2214,9 +2214,6 @@ static int tcp_seq_open(struct inode *inode, struct file
> *file)
>>        struct tcp_iter_state *s;
>>        int err;
>>
>> -       if (unlikely(afinfo == NULL))
>> -               return -EINVAL;
> I think that this check needs to stay in some form, reason below.
>> -
>>        err = seq_open_net(inode, file, &afinfo->seq_ops,
>>                          sizeof(struct tcp_iter_state));
>>        if (err < 0)
>> @@ -2241,10 +2238,9 @@ int tcp_proc_register(struct net *net, struct
> tcp_seq_afinfo *afinfo)
>>        afinfo->seq_ops.next            = tcp_seq_next;
>>        afinfo->seq_ops.stop            = tcp_seq_stop;
>>
>> - p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops);
>> -       if (p)
>> -               p->data = afinfo;
>> -       else
>> +       p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
>
> When you try to pass in afinfo->name (and also the seq_fops) you are
> assuming that afinfo is not null meaning in the unlikely(as shown
> above) even that it is null you get a very bad null pointer problem.
> If I am just way off do let me know because this just seams to me like
> a bad idea. This is also still present in 2.6.26-rc9.

It appears you are getting things confused.  The original window is that tcp_seq_open
(which is what get called when you open the proc file) had a small race that p->data
could be read before it was set.

With proc_create_data that race was closed.

You are saying that it is a problem for tcp_seq_open to be passed a NULL afinfo.
It is.  That has nothing to do with the original race (as that is a very
different part of the code).  Feel free to audit all of the callers if
you like.  That problem however is not subtle or racy.

So I see nothing wrong with this patch unless you can find a problem with
proc_create_data.

Eric

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

* Re: [PATCH 9/12] ipv4: assign PDE->data before gluing PDE into /proc tree
  2008-07-12  3:12   ` Stoyan Gaydarov
  2008-07-12  3:42     ` Eric W. Biederman
@ 2008-07-12 14:55     ` Denis V. Lunev
  1 sibling, 0 replies; 28+ messages in thread
From: Denis V. Lunev @ 2008-07-12 14:55 UTC (permalink / raw)
  To: Stoyan Gaydarov
  Cc: akpm, linux-kernel, Alexey Dobriyan, Eric W. Biederman,
	David S. Miller

On Fri, 2008-07-11 at 22:12 -0500, Stoyan Gaydarov wrote:
> First off, sorry to bring such an old email back but I can seem to get
> a bad feeling when looking back over it.
> 
> On Tue, Apr 29, 2008 at 6:13 AM, Denis V. Lunev <den@openvz.org> wrote:
> > The check for PDE->data != NULL becomes useless after the replacement
> > of proc_net_fops_create with proc_create_data.
> >
> > Signed-off-by: Denis V. Lunev <den@openvz.org>
> > Cc: Alexey Dobriyan <adobriyan@openvz.org>
> > Cc: Eric W. Biederman <ebiederm@xmission.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > ---
> >  net/ipv4/tcp_ipv4.c |   10 +++-------
> >  net/ipv4/udp.c      |    7 +++----
> >  2 files changed, 6 insertions(+), 11 deletions(-)
> >
> > diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> > index 7766151..4d97b28 100644
> > --- a/net/ipv4/tcp_ipv4.c
> > +++ b/net/ipv4/tcp_ipv4.c
> > @@ -2214,9 +2214,6 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
> >        struct tcp_iter_state *s;
> >        int err;
> >
> > -       if (unlikely(afinfo == NULL))
> > -               return -EINVAL;
> I think that this check needs to stay in some form, reason below.
> > -
> >        err = seq_open_net(inode, file, &afinfo->seq_ops,
> >                          sizeof(struct tcp_iter_state));
> >        if (err < 0)
> > @@ -2241,10 +2238,9 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
> >        afinfo->seq_ops.next            = tcp_seq_next;
> >        afinfo->seq_ops.stop            = tcp_seq_stop;
> >
> > -       p = proc_net_fops_create(net, afinfo->name, S_IRUGO, &afinfo->seq_fops);
> > -       if (p)
> > -               p->data = afinfo;
> > -       else
> > +       p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
> 
> When you try to pass in afinfo->name (and also the seq_fops) you are
> assuming that afinfo is not null meaning in the unlikely(as shown
> above) even that it is null you get a very bad null pointer problem.
> If I am just way off do let me know because this just seams to me like
> a bad idea. This is also still present in 2.6.26-rc9.

The reason to remove the check is simple - afinfo comes in the form of
the static pointer during init time. It is impossible to face NULL
pointer the problem in the reality. It can come as the programmer
mistake, but the OOPS will be immediate and straightforward. Namely, the
kernel will not boot/work at all.

Regards,
	Den


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

end of thread, other threads:[~2008-07-12 14:54 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29 11:12 [PATCH 0/12] Further PDE->data assignments cleanups Denis V. Lunev
2008-04-29 11:13 ` [PATCH 1/12] sunrpc: assign PDE->data before gluing PDE into /proc tree Denis V. Lunev
2008-05-02  9:44   ` David Miller
2008-04-29 11:13 ` [PATCH 2/12] netfilter: " Denis V. Lunev
2008-05-02  9:45   ` David Miller
2008-04-29 11:13 ` [PATCH 3/12] net: " Denis V. Lunev
2008-05-02  9:46   ` David Miller
2008-04-29 11:13 ` [PATCH 4/12] ipv6: " Denis V. Lunev
2008-05-02  9:47   ` David Miller
2008-04-29 11:13 ` [PATCH 5/12] atm: " Denis V. Lunev
2008-05-02 11:08   ` David Miller
2008-04-29 11:13 ` [PATCH 6/12] vlan: " Denis V. Lunev
2008-05-02 11:09   ` David Miller
2008-04-29 11:13 ` [PATCH 7/12] cciss: " Denis V. Lunev
2008-04-29 15:26   ` Miller, Mike (OS Dev)
2008-04-29 11:13 ` [PATCH 8/12] powerpc: " Denis V. Lunev
2008-04-29 11:13 ` [PATCH 9/12] ipv4: " Denis V. Lunev
2008-05-02 11:10   ` David Miller
2008-07-12  3:12   ` Stoyan Gaydarov
2008-07-12  3:42     ` Eric W. Biederman
2008-07-12 14:55     ` Denis V. Lunev
2008-04-29 11:13 ` [PATCH 10/12] netfilter: assign PDE->fops " Denis V. Lunev
2008-05-02 11:11   ` David Miller
2008-04-29 11:13 ` [PATCH 11/12] netfilter: assign PDE->data " Denis V. Lunev
2008-04-29 12:01   ` Patrick McHardy
2008-05-02 11:12   ` David Miller
2008-04-29 11:13 ` [PATCH 12/12] netns: assign PDE->data before gluing entry " Denis V. Lunev
2008-05-02 11:12   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox