diff options
author | Denis V. Lunev <den@openvz.org> | 2008-04-29 04:02:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:22 -0400 |
commit | ac41cfd19bf77424519b962f8205ede51fceaac6 (patch) | |
tree | f0299767b2115dd076e01841ca5cbe3113ef7a02 /drivers/isdn/hysdn/hysdn_procconf.c | |
parent | a95609cb0283a23e519e607ff9fc2a4aa77e2532 (diff) |
isdn: use non-racy method for proc entries creation
Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
be setup before gluing PDE to main tree.
Add correct ->owner to proc_fops to fix reading/module unloading race.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Karsten Keil <kkeil@suse.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn/hysdn/hysdn_procconf.c')
-rw-r--r-- | drivers/isdn/hysdn/hysdn_procconf.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 27d890b48f88..877be9922c3d 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -370,6 +370,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
370 | /******************************************************/ | 370 | /******************************************************/ |
371 | static const struct file_operations conf_fops = | 371 | static const struct file_operations conf_fops = |
372 | { | 372 | { |
373 | .owner = THIS_MODULE, | ||
373 | .llseek = no_llseek, | 374 | .llseek = no_llseek, |
374 | .read = hysdn_conf_read, | 375 | .read = hysdn_conf_read, |
375 | .write = hysdn_conf_write, | 376 | .write = hysdn_conf_write, |
@@ -402,11 +403,9 @@ hysdn_procconf_init(void) | |||
402 | while (card) { | 403 | while (card) { |
403 | 404 | ||
404 | sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); | 405 | sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); |
405 | if ((card->procconf = (void *) create_proc_entry(conf_name, | 406 | if ((card->procconf = (void *) proc_create(conf_name, |
406 | S_IFREG | S_IRUGO | S_IWUSR, | 407 | S_IFREG | S_IRUGO | S_IWUSR, |
407 | hysdn_proc_entry)) != NULL) { | 408 | hysdn_proc_entry)) != NULL) { |
408 | ((struct proc_dir_entry *) card->procconf)->proc_fops = &conf_fops; | ||
409 | ((struct proc_dir_entry *) card->procconf)->owner = THIS_MODULE; | ||
410 | hysdn_proclog_init(card); /* init the log file entry */ | 409 | hysdn_proclog_init(card); /* init the log file entry */ |
411 | } | 410 | } |
412 | card = card->next; /* next entry */ | 411 | card = card->next; /* next entry */ |