aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index d5d69ea8f249..e471d037fcc9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2788,10 +2788,10 @@ EXPORT_SYMBOL(tcp_gro_complete);
2788 2788
2789#ifdef CONFIG_TCP_MD5SIG 2789#ifdef CONFIG_TCP_MD5SIG
2790static unsigned long tcp_md5sig_users; 2790static unsigned long tcp_md5sig_users;
2791static struct tcp_md5sig_pool **tcp_md5sig_pool; 2791static struct tcp_md5sig_pool * __percpu *tcp_md5sig_pool;
2792static DEFINE_SPINLOCK(tcp_md5sig_pool_lock); 2792static DEFINE_SPINLOCK(tcp_md5sig_pool_lock);
2793 2793
2794static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool **pool) 2794static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool * __percpu *pool)
2795{ 2795{
2796 int cpu; 2796 int cpu;
2797 for_each_possible_cpu(cpu) { 2797 for_each_possible_cpu(cpu) {
@@ -2808,7 +2808,7 @@ static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool **pool)
2808 2808
2809void tcp_free_md5sig_pool(void) 2809void tcp_free_md5sig_pool(void)
2810{ 2810{
2811 struct tcp_md5sig_pool **pool = NULL; 2811 struct tcp_md5sig_pool * __percpu *pool = NULL;
2812 2812
2813 spin_lock_bh(&tcp_md5sig_pool_lock); 2813 spin_lock_bh(&tcp_md5sig_pool_lock);
2814 if (--tcp_md5sig_users == 0) { 2814 if (--tcp_md5sig_users == 0) {
@@ -2822,10 +2822,11 @@ void tcp_free_md5sig_pool(void)
2822 2822
2823EXPORT_SYMBOL(tcp_free_md5sig_pool); 2823EXPORT_SYMBOL(tcp_free_md5sig_pool);
2824 2824
2825static struct tcp_md5sig_pool **__tcp_alloc_md5sig_pool(struct sock *sk) 2825static struct tcp_md5sig_pool * __percpu *
2826__tcp_alloc_md5sig_pool(struct sock *sk)
2826{ 2827{
2827 int cpu; 2828 int cpu;
2828 struct tcp_md5sig_pool **pool; 2829 struct tcp_md5sig_pool * __percpu *pool;
2829 2830
2830 pool = alloc_percpu(struct tcp_md5sig_pool *); 2831 pool = alloc_percpu(struct tcp_md5sig_pool *);
2831 if (!pool) 2832 if (!pool)
@@ -2852,9 +2853,9 @@ out_free:
2852 return NULL; 2853 return NULL;
2853} 2854}
2854 2855
2855struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *sk) 2856struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *sk)
2856{ 2857{
2857 struct tcp_md5sig_pool **pool; 2858 struct tcp_md5sig_pool * __percpu *pool;
2858 int alloc = 0; 2859 int alloc = 0;
2859 2860
2860retry: 2861retry:
@@ -2873,7 +2874,9 @@ retry:
2873 2874
2874 if (alloc) { 2875 if (alloc) {
2875 /* we cannot hold spinlock here because this may sleep. */ 2876 /* we cannot hold spinlock here because this may sleep. */
2876 struct tcp_md5sig_pool **p = __tcp_alloc_md5sig_pool(sk); 2877 struct tcp_md5sig_pool * __percpu *p;
2878
2879 p = __tcp_alloc_md5sig_pool(sk);
2877 spin_lock_bh(&tcp_md5sig_pool_lock); 2880 spin_lock_bh(&tcp_md5sig_pool_lock);
2878 if (!p) { 2881 if (!p) {
2879 tcp_md5sig_users--; 2882 tcp_md5sig_users--;
@@ -2897,7 +2900,7 @@ EXPORT_SYMBOL(tcp_alloc_md5sig_pool);
2897 2900
2898struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu) 2901struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu)
2899{ 2902{
2900 struct tcp_md5sig_pool **p; 2903 struct tcp_md5sig_pool * __percpu *p;
2901 spin_lock_bh(&tcp_md5sig_pool_lock); 2904 spin_lock_bh(&tcp_md5sig_pool_lock);
2902 p = tcp_md5sig_pool; 2905 p = tcp_md5sig_pool;
2903 if (p) 2906 if (p)