aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-07-20 16:24:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-07-20 19:25:41 -0400
commit844b9a8707f1fcf0482e0c52f44a555e799ccda6 (patch)
treec9c095c123c2988b014e39b461eb04411b3a197d /include
parent9d51a6b2487724e8713cd2794cf09ffeee5f6932 (diff)
vfs: fix RCU-lockdep false positive due to /proc
If a single-threaded process does a file-descriptor operation, and some other process accesses that same file descriptor via /proc, the current rcu_dereference_check_fdtable() can give a false-positive RCU-lockdep splat due to the reference count being increased by the /proc access after the reference-count check in fget_light() but before the check in rcu_dereference_check_fdtable(). This commit prevents this false positive by checking for a single-threaded process. To avoid #include hell, this commit uses the wrapper for thread_group_empty(current) defined by rcu_my_thread_group_empty() provided in a separate commit. Located-by: Miles Lane <miles.lane@gmail.com> Located-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fdtable.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 013dc529e95f..d147461bc271 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -61,7 +61,8 @@ struct files_struct {
61 (rcu_dereference_check((fdtfd), \ 61 (rcu_dereference_check((fdtfd), \
62 rcu_read_lock_held() || \ 62 rcu_read_lock_held() || \
63 lockdep_is_held(&(files)->file_lock) || \ 63 lockdep_is_held(&(files)->file_lock) || \
64 atomic_read(&(files)->count) == 1)) 64 atomic_read(&(files)->count) == 1 || \
65 rcu_my_thread_group_empty()))
65 66
66#define files_fdtable(files) \ 67#define files_fdtable(files) \
67 (rcu_dereference_check_fdtable((files), (files)->fdt)) 68 (rcu_dereference_check_fdtable((files), (files)->fdt))