aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hysdn
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-29 04:02:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:22 -0400
commitac41cfd19bf77424519b962f8205ede51fceaac6 (patch)
treef0299767b2115dd076e01841ca5cbe3113ef7a02 /drivers/isdn/hysdn
parenta95609cb0283a23e519e607ff9fc2a4aa77e2532 (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')
-rw-r--r--drivers/isdn/hysdn/hysdn_procconf.c9
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c8
2 files changed, 8 insertions, 9 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/******************************************************/
371static const struct file_operations conf_fops = 371static 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 */
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index 27b3991fb0ec..8991d2c8ee4a 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -380,6 +380,7 @@ hysdn_log_poll(struct file *file, poll_table * wait)
380/**************************************************/ 380/**************************************************/
381static const struct file_operations log_fops = 381static const struct file_operations log_fops =
382{ 382{
383 .owner = THIS_MODULE,
383 .llseek = no_llseek, 384 .llseek = no_llseek,
384 .read = hysdn_log_read, 385 .read = hysdn_log_read,
385 .write = hysdn_log_write, 386 .write = hysdn_log_write,
@@ -402,10 +403,9 @@ hysdn_proclog_init(hysdn_card * card)
402 403
403 if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { 404 if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
404 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); 405 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
405 if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) { 406 pd->log = proc_create(pd->log_name,
406 pd->log->proc_fops = &log_fops; 407 S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry,
407 pd->log->owner = THIS_MODULE; 408 &log_fops);
408 }
409 409
410 init_waitqueue_head(&(pd->rd_queue)); 410 init_waitqueue_head(&(pd->rd_queue));
411 411