Patchwork [2/2] net/core: add lock context change annotations in net/core/sock.c

login
register
mail settings
Submitter Namhyung Kim
Date Sept. 8, 2010, 1:48 p.m.
Message ID <1283953728-15302-2-git-send-email-namhyung@gmail.com>
Download mbox | patch
Permalink /patch/64133/
State Accepted
Delegated to: David Miller
Headers show

Comments

Namhyung Kim - Sept. 8, 2010, 1:48 p.m.
__lock_sock() and __release_sock() releases and regrabs lock but
were missing proper annotations. Add it. This removes following
warning from sparse. (Currently __lock_sock() does not emit any
warning about it but I think it is better to add also.)

 net/core/sock.c:1580:17: warning: context imbalance in '__release_sock' - unexpected unlock

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 net/core/sock.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
David Miller - Sept. 9, 2010, 10:03 p.m.
From: Namhyung Kim <namhyung@gmail.com>
Date: Wed,  8 Sep 2010 22:48:48 +0900

> __lock_sock() and __release_sock() releases and regrabs lock but
> were missing proper annotations. Add it. This removes following
> warning from sparse. (Currently __lock_sock() does not emit any
> warning about it but I think it is better to add also.)
> 
>  net/core/sock.c:1580:17: warning: context imbalance in '__release_sock' - unexpected unlock
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/core/sock.c b/net/core/sock.c
index b05b9b6..f3a06c4 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1557,6 +1557,8 @@  struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
 EXPORT_SYMBOL(sock_alloc_send_skb);
 
 static void __lock_sock(struct sock *sk)
+	__releases(&sk->sk_lock.slock)
+	__acquires(&sk->sk_lock.slock)
 {
 	DEFINE_WAIT(wait);
 
@@ -1573,6 +1575,8 @@  static void __lock_sock(struct sock *sk)
 }
 
 static void __release_sock(struct sock *sk)
+	__releases(&sk->sk_lock.slock)
+	__acquires(&sk->sk_lock.slock)
 {
 	struct sk_buff *skb = sk->sk_backlog.head;