mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
tcp: properly handle md5sig_pool references
tcp_v4_clear_md5_list() assumes that multiple tcp md5sig peers only hold one reference to md5sig_pool. but tcp_v4_md5_do_add() increases use count of md5sig_pool for each peer. This patch makes tcp_v4_md5_do_add() only increases use count for the first tcp md5sig peer. Signed-off-by: Zheng Yan <zheng.z.yan@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cb2d0f3e96
commit
260fcbeb1a
2 changed files with 12 additions and 7 deletions
|
@ -591,7 +591,8 @@ static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer,
|
|||
}
|
||||
sk_nocaps_add(sk, NETIF_F_GSO_MASK);
|
||||
}
|
||||
if (tcp_alloc_md5sig_pool(sk) == NULL) {
|
||||
if (tp->md5sig_info->entries6 == 0 &&
|
||||
tcp_alloc_md5sig_pool(sk) == NULL) {
|
||||
kfree(newkey);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -600,8 +601,9 @@ static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer,
|
|||
(tp->md5sig_info->entries6 + 1)), GFP_ATOMIC);
|
||||
|
||||
if (!keys) {
|
||||
tcp_free_md5sig_pool();
|
||||
kfree(newkey);
|
||||
if (tp->md5sig_info->entries6 == 0)
|
||||
tcp_free_md5sig_pool();
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -647,6 +649,7 @@ static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer)
|
|||
kfree(tp->md5sig_info->keys6);
|
||||
tp->md5sig_info->keys6 = NULL;
|
||||
tp->md5sig_info->alloced6 = 0;
|
||||
tcp_free_md5sig_pool();
|
||||
} else {
|
||||
/* shrink the database */
|
||||
if (tp->md5sig_info->entries6 != i)
|
||||
|
@ -655,7 +658,6 @@ static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer)
|
|||
(tp->md5sig_info->entries6 - i)
|
||||
* sizeof (tp->md5sig_info->keys6[0]));
|
||||
}
|
||||
tcp_free_md5sig_pool();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue