From: Wang Chen <wangchen@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, chas3@users.sourceforge.net
Subject: take#2: [PATCH] [ATM]: Add error handling for proc_create fail
Date: Mon, 03 Mar 2008 10:44:33 +0800 [thread overview]
Message-ID: <47CB6611.30004@cn.fujitsu.com> (raw)
In-Reply-To: <20080229.103803.151963676.davem@davemloft.net>
David Miller said the following on 2008-3-1 2:38:
> This is not sufficient. If this fails you need to unregister
> the ioctl and all of the other things that get registered
> before this procfs registry runs.
>
When proc_create() fail, we return -ENOMEM.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
net/atm/clip.c | 18 ++++++++++--------
net/atm/lec.c | 4 ++++
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/net/atm/clip.c b/net/atm/clip.c
index d30167c..66e5a91 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -949,6 +949,16 @@ static const struct file_operations arp_seq_fops = {
static int __init atm_clip_init(void)
{
+#ifdef CONFIG_PROC_FS
+ struct proc_dir_entry *p;
+
+ p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
+ if (!p) {
+ printk(KERN_ERR "Unable to initialize /proc/net/atm/arp\n");
+ return -ENOMEM;
+ }
+#endif
+
neigh_table_init_no_netlink(&clip_tbl);
clip_tbl_hook = &clip_tbl;
@@ -958,14 +968,6 @@ static int __init atm_clip_init(void)
setup_timer(&idle_timer, idle_timer_check, 0);
-#ifdef CONFIG_PROC_FS
- {
- struct proc_dir_entry *p;
-
- p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
- }
-#endif
-
return 0;
}
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 0e450d1..a2efa7f 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1250,6 +1250,10 @@ static int __init lane_module_init(void)
struct proc_dir_entry *p;
p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
+ if (!p) {
+ printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n");
+ return -ENOMEM;
+ }
#endif
register_atm_ioctl(&lane_ioctl_ops);
--
WCN
next prev parent reply other threads:[~2008-03-03 2:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 7:43 [PATCH] [ATM]: Add error handling for proc_create fail Wang Chen
2008-02-29 12:42 ` chas williams - CONTRACTOR
2008-02-29 18:38 ` David Miller
2008-03-03 2:44 ` Wang Chen [this message]
2008-03-03 5:09 ` take#2: " David Miller
2008-03-03 8:46 ` take#3: " Wang Chen
2008-03-04 7:27 ` take#4: " Wang Chen
2008-03-24 4:47 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47CB6611.30004@cn.fujitsu.com \
--to=wangchen@cn.fujitsu.com \
--cc=chas3@users.sourceforge.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).