diff options
| author | David S. Miller <davem@davemloft.net> | 2010-05-17 01:26:58 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-05-17 01:26:58 -0400 |
| commit | 6811d58fc148c393f80a9f5a9db49d7e75cdc546 (patch) | |
| tree | c25d5b0e49ec848943d35f819e748d157ccb492e /net/ipv4 | |
| parent | c4949f074332a64baeb2ead6ab9319ca37642f96 (diff) | |
| parent | c02db8c6290bb992442fec1407643c94cc414375 (diff) | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
include/linux/if_link.h
Diffstat (limited to 'net/ipv4')
| -rw-r--r-- | net/ipv4/tcp.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 8ce29747ad9b..3284393d09b4 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -2840,7 +2840,6 @@ static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool * __percpu *pool) | |||
| 2840 | if (p->md5_desc.tfm) | 2840 | if (p->md5_desc.tfm) |
| 2841 | crypto_free_hash(p->md5_desc.tfm); | 2841 | crypto_free_hash(p->md5_desc.tfm); |
| 2842 | kfree(p); | 2842 | kfree(p); |
| 2843 | p = NULL; | ||
| 2844 | } | 2843 | } |
| 2845 | } | 2844 | } |
| 2846 | free_percpu(pool); | 2845 | free_percpu(pool); |
| @@ -2938,25 +2937,40 @@ retry: | |||
| 2938 | 2937 | ||
| 2939 | EXPORT_SYMBOL(tcp_alloc_md5sig_pool); | 2938 | EXPORT_SYMBOL(tcp_alloc_md5sig_pool); |
| 2940 | 2939 | ||
| 2941 | struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu) | 2940 | |
| 2941 | /** | ||
| 2942 | * tcp_get_md5sig_pool - get md5sig_pool for this user | ||
| 2943 | * | ||
| 2944 | * We use percpu structure, so if we succeed, we exit with preemption | ||
| 2945 | * and BH disabled, to make sure another thread or softirq handling | ||
| 2946 | * wont try to get same context. | ||
| 2947 | */ | ||
| 2948 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) | ||
| 2942 | { | 2949 | { |
| 2943 | struct tcp_md5sig_pool * __percpu *p; | 2950 | struct tcp_md5sig_pool * __percpu *p; |
| 2944 | spin_lock_bh(&tcp_md5sig_pool_lock); | 2951 | |
| 2952 | local_bh_disable(); | ||
| 2953 | |||
| 2954 | spin_lock(&tcp_md5sig_pool_lock); | ||
| 2945 | p = tcp_md5sig_pool; | 2955 | p = tcp_md5sig_pool; |
| 2946 | if (p) | 2956 | if (p) |
| 2947 | tcp_md5sig_users++; | 2957 | tcp_md5sig_users++; |
| 2948 | spin_unlock_bh(&tcp_md5sig_pool_lock); | 2958 | spin_unlock(&tcp_md5sig_pool_lock); |
| 2949 | return (p ? *per_cpu_ptr(p, cpu) : NULL); | 2959 | |
| 2950 | } | 2960 | if (p) |
| 2961 | return *per_cpu_ptr(p, smp_processor_id()); | ||
| 2951 | 2962 | ||
| 2952 | EXPORT_SYMBOL(__tcp_get_md5sig_pool); | 2963 | local_bh_enable(); |
| 2964 | return NULL; | ||
| 2965 | } | ||
| 2966 | EXPORT_SYMBOL(tcp_get_md5sig_pool); | ||
| 2953 | 2967 | ||
| 2954 | void __tcp_put_md5sig_pool(void) | 2968 | void tcp_put_md5sig_pool(void) |
| 2955 | { | 2969 | { |
| 2970 | local_bh_enable(); | ||
| 2956 | tcp_free_md5sig_pool(); | 2971 | tcp_free_md5sig_pool(); |
| 2957 | } | 2972 | } |
| 2958 | 2973 | EXPORT_SYMBOL(tcp_put_md5sig_pool); | |
| 2959 | EXPORT_SYMBOL(__tcp_put_md5sig_pool); | ||
| 2960 | 2974 | ||
| 2961 | int tcp_md5_hash_header(struct tcp_md5sig_pool *hp, | 2975 | int tcp_md5_hash_header(struct tcp_md5sig_pool *hp, |
| 2962 | struct tcphdr *th) | 2976 | struct tcphdr *th) |
