lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E7FE4DD.5070804@intel.com>
Date:	Mon, 26 Sep 2011 10:35:09 +0800
From:	"Yan, Zheng" <zheng.z.yan@...el.com>
To:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	yoshfuji@...ux-ipv6.org
Subject: [PATCH] tcp: properly release md5sig_pool references

tcp_v4_md5_do_add() increases use count of md5sig_pool by one for
each tcp md5sig peer, so we should call tcp_free_md5sig_pool() for
each peer when destroying the socket.

Signed-off-by: Zheng Yan <zheng.z.yan@...el.com>
---
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c34f015..3ca72ae 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1007,10 +1007,11 @@ static void tcp_v4_clear_md5_list(struct sock *sk)
 	 */
 	if (tp->md5sig_info->entries4) {
 		int i;
-		for (i = 0; i < tp->md5sig_info->entries4; i++)
+		for (i = 0; i < tp->md5sig_info->entries4; i++) {
 			kfree(tp->md5sig_info->keys4[i].base.key);
+			tcp_free_md5sig_pool();
+		}
 		tp->md5sig_info->entries4 = 0;
-		tcp_free_md5sig_pool();
 	}
 	if (tp->md5sig_info->keys4) {
 		kfree(tp->md5sig_info->keys4);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3c9fa61..9dcef7c 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -668,10 +668,11 @@ static void tcp_v6_clear_md5_list (struct sock *sk)
 	int i;
 
 	if (tp->md5sig_info->entries6) {
-		for (i = 0; i < tp->md5sig_info->entries6; i++)
+		for (i = 0; i < tp->md5sig_info->entries6; i++) {
 			kfree(tp->md5sig_info->keys6[i].base.key);
+			tcp_free_md5sig_pool();
+		}
 		tp->md5sig_info->entries6 = 0;
-		tcp_free_md5sig_pool();
 	}
 
 	kfree(tp->md5sig_info->keys6);
@@ -679,10 +680,11 @@ static void tcp_v6_clear_md5_list (struct sock *sk)
 	tp->md5sig_info->alloced6 = 0;
 
 	if (tp->md5sig_info->entries4) {
-		for (i = 0; i < tp->md5sig_info->entries4; i++)
+		for (i = 0; i < tp->md5sig_info->entries4; i++) {
 			kfree(tp->md5sig_info->keys4[i].base.key);
+			tcp_free_md5sig_pool();
+		}
 		tp->md5sig_info->entries4 = 0;
-		tcp_free_md5sig_pool();
 	}
 
 	kfree(tp->md5sig_info->keys4);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ