From: Andrew Morton nfi what went wrong there. Cc: Darrick J. Wong Cc: "Eric W. Biederman" Cc: Oleg Nesterov Signed-off-by: Andrew Morton --- fs/proc/inode.c | 9 +-------- include/linux/proc_fs.h | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff -puN include/linux/proc_fs.h~procfs-fix-race-between-proc_readdir-and-remove_proc_entry-fix include/linux/proc_fs.h --- a/include/linux/proc_fs.h~procfs-fix-race-between-proc_readdir-and-remove_proc_entry-fix +++ a/include/linux/proc_fs.h @@ -275,4 +275,13 @@ struct proc_maps_private { #endif }; +static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) +{ + if (de) + atomic_inc(&de->count); + return de; +} + +void de_put(struct proc_dir_entry *de); + #endif /* _LINUX_PROC_FS_H */ diff -puN fs/proc/generic.c~procfs-fix-race-between-proc_readdir-and-remove_proc_entry-fix fs/proc/generic.c diff -puN fs/proc/inode.c~procfs-fix-race-between-proc_readdir-and-remove_proc_entry-fix fs/proc/inode.c --- a/fs/proc/inode.c~procfs-fix-race-between-proc_readdir-and-remove_proc_entry-fix +++ a/fs/proc/inode.c @@ -21,17 +21,10 @@ #include "internal.h" -static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) -{ - if (de) - atomic_inc(&de->count); - return de; -} - /* * Decrements the use count and checks for deferred deletion. */ -static void de_put(struct proc_dir_entry *de) +void de_put(struct proc_dir_entry *de) { if (de) { lock_kernel(); _