Commit b8ed374e authored by Namhyung Kim's avatar Namhyung Kim Committed by Linus Torvalds

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarNamhyung 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5ef45079
...@@ -2236,9 +2236,16 @@ static inline void task_unlock(struct task_struct *p) ...@@ -2236,9 +2236,16 @@ static inline void task_unlock(struct task_struct *p)
spin_unlock(&p->alloc_lock); spin_unlock(&p->alloc_lock);
} }
extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk, extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
unsigned long *flags); unsigned long *flags);
#define lock_task_sighand(tsk, flags) \
({ struct sighand_struct *__ss; \
__cond_lock(&(tsk)->sighand->siglock, \
(__ss = __lock_task_sighand(tsk, flags))); \
__ss; \
}) \
static inline void unlock_task_sighand(struct task_struct *tsk, static inline void unlock_task_sighand(struct task_struct *tsk,
unsigned long *flags) unsigned long *flags)
{ {
......
...@@ -1105,7 +1105,8 @@ int zap_other_threads(struct task_struct *p) ...@@ -1105,7 +1105,8 @@ int zap_other_threads(struct task_struct *p)
return count; return count;
} }
struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
unsigned long *flags)
{ {
struct sighand_struct *sighand; struct sighand_struct *sighand;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment