aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-27 18:34:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:03:12 -0400
commitb8ed374e202e23caaf9bd77dcadc9de6447faaa8 (patch)
treeea97fe186c7e0c0ee8cd61e0fc94dc42f635fd3b
parent5ef45079dd9c8f2e9c7aa788dc3121835ae52863 (diff)
signals: annotate lock_task_sighand()
lock_task_sighand() grabs sighand->siglock in case of returning non-NULL but unlock_task_sighand() releases it unconditionally. This leads sparse to complain about the lock context imbalance. Rename and wrap lock_task_sighand() using __cond_lock() macro to make sparse happy. Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Namhyung Kim <namhyung@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/sched.h9
-rw-r--r--kernel/signal.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 393ce94e54b7..3ff5c8519abd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2236,9 +2236,16 @@ static inline void task_unlock(struct task_struct *p)
2236 spin_unlock(&p->alloc_lock); 2236 spin_unlock(&p->alloc_lock);
2237} 2237}
2238 2238
2239extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk, 2239extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
2240 unsigned long *flags); 2240 unsigned long *flags);
2241 2241
2242#define lock_task_sighand(tsk, flags) \
2243({ struct sighand_struct *__ss; \
2244 __cond_lock(&(tsk)->sighand->siglock, \
2245 (__ss = __lock_task_sighand(tsk, flags))); \
2246 __ss; \
2247}) \
2248
2242static inline void unlock_task_sighand(struct task_struct *tsk, 2249static inline void unlock_task_sighand(struct task_struct *tsk,
2243 unsigned long *flags) 2250 unsigned long *flags)
2244{ 2251{
diff --git a/kernel/signal.c b/kernel/signal.c
index 919562c3d6b7..e921409b85a9 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1105,7 +1105,8 @@ int zap_other_threads(struct task_struct *p)
1105 return count; 1105 return count;
1106} 1106}
1107 1107
1108struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) 1108struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
1109 unsigned long *flags)
1109{ 1110{
1110 struct sighand_struct *sighand; 1111 struct sighand_struct *sighand;
1111 1112