signal: annotate lock_task_sighand()
A message that is not in the archive (sent off-list or not yet received): [email protected]
Add missing Cc.
Quoted 8 lines · Namhyung Kim
lock_task_sighand()grabssighand->siglockin case of returning non-NULL butunlock_task_sighand()releases it unconditionally. This leads sparse to complain about the lock context imbalance. Rename and wraplock_task_sighand()using__cond_lock()macro to make sparse happy.Suggested-by Eric Dumazet <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Roland McGrath <[email protected]>
Quoted 45 lines
---
include/linux/sched.h | 9 ++++++++-
kernel/signal.c | 3 ++-2 files changed, 10 insertions(+), 2 deletions(-)include/linux/sched.h +8
-1@@ -2210,9 +2210,16 @@ static inline void task_unlock(struct task_struct *p) 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); +#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, unsigned long *flags) {kernel/signal.c +2
-2@@ -1105,7 +1105,8 @@ int zap_other_threads(struct task_struct *p) 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; --1.7.2.2
Signature · 2 lines
Regards, Namhyung Kim