From 7695650a924a6859910c8c19dfa43b4d08224d66 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 8 May 2007 00:25:45 -0700 Subject: Fix race between proc_get_inode() and remove_proc_entry() proc_lookup remove_proc_entry =========== ================= lock_kernel(); spin_lock(&proc_subdir_lock); [find PDE with refcount 0] spin_unlock(&proc_subdir_lock); spin_lock(&proc_subdir_lock); [find PDE with refcount 0] [check refcount and free PDE] spin_unlock(&proc_subdir_lock); proc_get_inode: de_get(de); /* boom */ Signed-off-by: Alexey Dobriyan Cc: "Eric W. Biederman" Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/proc_fs.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux/proc_fs.h') diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index f4f7a63cae1..3469f96bc8b 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -106,6 +106,9 @@ int task_statm(struct mm_struct *, int *, int *, int *, int *); char *task_mem(struct mm_struct *, char *); void clear_refs_smap(struct mm_struct *mm); +struct proc_dir_entry *de_get(struct proc_dir_entry *de); +void de_put(struct proc_dir_entry *de); + extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent); extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); -- cgit v1.2.3