diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-11-16 11:06:06 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:51 -0500 |
commit | 58a5a7b9555ea231b557ebef5cabeaf8e951df0b (patch) | |
tree | 9dac36b3483e9667a967f79982c965abd707e03d /net/core | |
parent | e523a1550e877f8a8ff87a50269b7ee7bfb43464 (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.c | 7 |
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 | } |
271 | EXPORT_SYMBOL(sock_queue_rcv_skb); | 271 | EXPORT_SYMBOL(sock_queue_rcv_skb); |
272 | 272 | ||
273 | int sk_receive_skb(struct sock *sk, struct sk_buff *skb) | 273 | int 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: |