aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-11-16 11:06:06 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:23:51 -0500
commit58a5a7b9555ea231b557ebef5cabeaf8e951df0b (patch)
tree9dac36b3483e9667a967f79982c965abd707e03d /net/core
parente523a1550e877f8a8ff87a50269b7ee7bfb43464 (diff)
[NET]: Conditionally use bh_lock_sock_nested in sk_receive_skb
Spotted by Ian McDonald, tentatively fixed by Gerrit Renker: http://www.mail-archive.com/dccp%40vger.kernel.org/msg00599.html Rewritten not to unroll sk_receive_skb, in the common case, i.e. no lock debugging, its optimized away. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 32ff1c551d69..ab8fafadb4ba 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -270,7 +270,7 @@ out:
270} 270}
271EXPORT_SYMBOL(sock_queue_rcv_skb); 271EXPORT_SYMBOL(sock_queue_rcv_skb);
272 272
273int sk_receive_skb(struct sock *sk, struct sk_buff *skb) 273int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested)
274{ 274{
275 int rc = NET_RX_SUCCESS; 275 int rc = NET_RX_SUCCESS;
276 276
@@ -279,7 +279,10 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
279 279
280 skb->dev = NULL; 280 skb->dev = NULL;
281 281
282 bh_lock_sock(sk); 282 if (nested)
283 bh_lock_sock_nested(sk);
284 else
285 bh_lock_sock(sk);
283 if (!sock_owned_by_user(sk)) { 286 if (!sock_owned_by_user(sk)) {
284 /* 287 /*
285 * trylock + unlock semantics: 288 * trylock + unlock semantics: