aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_ipv4.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 1d5fd82c5c0..da5d3226771 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -943,11 +943,11 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
943 tp->md5sig_info = md5sig; 943 tp->md5sig_info = md5sig;
944 } 944 }
945 945
946 key = kmalloc(sizeof(*key), gfp); 946 key = sock_kmalloc(sk, sizeof(*key), gfp);
947 if (!key) 947 if (!key)
948 return -ENOMEM; 948 return -ENOMEM;
949 if (hlist_empty(&md5sig->head) && !tcp_alloc_md5sig_pool(sk)) { 949 if (hlist_empty(&md5sig->head) && !tcp_alloc_md5sig_pool(sk)) {
950 kfree(key); 950 sock_kfree_s(sk, key, sizeof(*key));
951 return -ENOMEM; 951 return -ENOMEM;
952 } 952 }
953 953
@@ -971,6 +971,7 @@ int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, int family)
971 if (!key) 971 if (!key)
972 return -ENOENT; 972 return -ENOENT;
973 hlist_del_rcu(&key->node); 973 hlist_del_rcu(&key->node);
974 atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
974 kfree_rcu(key, rcu); 975 kfree_rcu(key, rcu);
975 if (hlist_empty(&tp->md5sig_info->head)) 976 if (hlist_empty(&tp->md5sig_info->head))
976 tcp_free_md5sig_pool(); 977 tcp_free_md5sig_pool();
@@ -988,6 +989,7 @@ void tcp_clear_md5_list(struct sock *sk)
988 tcp_free_md5sig_pool(); 989 tcp_free_md5sig_pool();
989 hlist_for_each_entry_safe(key, pos, n, &tp->md5sig_info->head, node) { 990 hlist_for_each_entry_safe(key, pos, n, &tp->md5sig_info->head, node) {
990 hlist_del_rcu(&key->node); 991 hlist_del_rcu(&key->node);
992 atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
991 kfree_rcu(key, rcu); 993 kfree_rcu(key, rcu);
992 } 994 }
993} 995}