Skip to content

Commit 19b4fc5

Browse files
dlunevtorvalds
authored andcommitted
reiserfs: 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. /proc entry owner is also added. Signed-off-by: Denis V. Lunev <den@openvz.org> Cc: Jeff Mahoney <jeffm@suse.com> Cc: Chris Mason <chris.mason@oracle.com> 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>
1 parent 46fe74f commit 19b4fc5

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎fs/reiserfs/procfs.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ static const struct file_operations r_file_operations = {
467467
.read = seq_read,
468468
.llseek = seq_lseek,
469469
.release = seq_release,
470+
.owner = THIS_MODULE,
470471
};
471472

472473
static struct proc_dir_entry *proc_info_root = NULL;
@@ -475,12 +476,8 @@ static const char proc_info_root_name[] = "fs/reiserfs";
475476
static void add_file(struct super_block *sb, char *name,
476477
int (*func) (struct seq_file *, struct super_block *))
477478
{
478-
struct proc_dir_entry *de;
479-
de = create_proc_entry(name, 0, REISERFS_SB(sb)->procdir);
480-
if (de) {
481-
de->data = func;
482-
de->proc_fops = &r_file_operations;
483-
}
479+
proc_create_data(name, 0, REISERFS_SB(sb)->procdir,
480+
&r_file_operations, func);
484481
}
485482

486483
int reiserfs_proc_info_init(struct super_block *sb)

0 commit comments

Comments
 (0)