[PATCH 3/3] ptrace: annotate siglock acquirement

From: Namhyung Kim
Date: Sun Aug 22 2010 - 06:22:45 EST


lock_task_sighand() conditionally acquires 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. Annotate it
to make sparse happier.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
---
kernel/ptrace.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 1abbb4d..4553275 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -438,6 +438,7 @@ static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info)
int error = -ESRCH;

if (lock_task_sighand(child, &flags)) {
+ __acquire(&child->sighand->siglock);
error = -EINVAL;
if (likely(child->last_siginfo != NULL)) {
*info = *child->last_siginfo;
@@ -454,6 +455,7 @@ static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info)
int error = -ESRCH;

if (lock_task_sighand(child, &flags)) {
+ __acquire(&child->sighand->siglock);
error = -EINVAL;
if (likely(child->last_siginfo != NULL)) {
*child->last_siginfo = *info;
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/