Re: [PATCH] signal: annotate siglock acquisition

From: Eric Dumazet
Date: Sat Sep 25 2010 - 05:42:43 EST


Le samedi 25 septembre 2010 Ã 18:21 +0900, Namhyung Kim a Ãcrit :
> 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.

> @@ -1403,7 +1404,9 @@ int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group)
> BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
>
> ret = -1;
> - if (!likely(lock_task_sighand(t, &flags)))
> + if (likely(lock_task_sighand(t, &flags)))
> + __acquire(&t->sighand->siglock);
> + else
> goto ret;
>
> ret = 1; /* the signal is ignored */

making sparse happy is good, but changing a likely clause is not,
unless you meant it ;)

maybe -->

if (!likely(lock_task_sighand(t, &flags)))
goto ret;
else
__acquire(&t->sighand->siglock);



--
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/