From 670d62b05e882b02786434064c246a1707075d2f Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 19 Nov 2007 22:37:58 -0800 Subject: [PATCH] --- yaml --- r: 78165 b: refs/heads/master c: ab70768ec78c6784958bab3b58fbe3f4150006df h: refs/heads/master i: 78163: fb8278aff982e802a93652dc15a2c466c0f95c69 v: v3 --- [refs] | 2 +- trunk/include/net/raw.h | 1 + trunk/net/ipv4/raw.c | 14 ++++++++++---- trunk/net/ipv6/raw.c | 5 +---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index eafacee8e8c7..f5fd7d2eefd7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 65b4c50b47c4ac3d2b5a82e5553b8e5613fb9585 +refs/heads/master: ab70768ec78c6784958bab3b58fbe3f4150006df diff --git a/trunk/include/net/raw.h b/trunk/include/net/raw.h index 43f1e3c07380..81a1773b58ba 100644 --- a/trunk/include/net/raw.h +++ b/trunk/include/net/raw.h @@ -40,5 +40,6 @@ extern void raw_proc_exit(void); #endif void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); +void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h); #endif /* _RAW_H */ diff --git a/trunk/net/ipv4/raw.c b/trunk/net/ipv4/raw.c index 28b95ae5d2dc..d24501a342a4 100644 --- a/trunk/net/ipv4/raw.c +++ b/trunk/net/ipv4/raw.c @@ -97,6 +97,15 @@ void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h) } EXPORT_SYMBOL_GPL(raw_hash_sk); +void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h) +{ + write_lock_bh(&h->lock); + if (sk_del_node_init(sk)) + sock_prot_dec_use(sk->sk_prot); + write_unlock_bh(&h->lock); +} +EXPORT_SYMBOL_GPL(raw_unhash_sk); + static void raw_v4_hash(struct sock *sk) { raw_hash_sk(sk, &raw_v4_hashinfo); @@ -104,10 +113,7 @@ static void raw_v4_hash(struct sock *sk) static void raw_v4_unhash(struct sock *sk) { - write_lock_bh(&raw_v4_hashinfo.lock); - if (sk_del_node_init(sk)) - sock_prot_dec_use(sk->sk_prot); - write_unlock_bh(&raw_v4_hashinfo.lock); + raw_unhash_sk(sk, &raw_v4_hashinfo); } static struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, diff --git a/trunk/net/ipv6/raw.c b/trunk/net/ipv6/raw.c index 70db6f494538..422d27cfbe16 100644 --- a/trunk/net/ipv6/raw.c +++ b/trunk/net/ipv6/raw.c @@ -72,10 +72,7 @@ static void raw_v6_hash(struct sock *sk) static void raw_v6_unhash(struct sock *sk) { - write_lock_bh(&raw_v6_hashinfo.lock); - if (sk_del_node_init(sk)) - sock_prot_dec_use(sk->sk_prot); - write_unlock_bh(&raw_v6_hashinfo.lock); + raw_unhash_sk(sk, &raw_v6_hashinfo); }