Skip to contentSkip to conversation

Patch "tcp: fix a request socket leak" has been added to the 4.13-stable tree

PATCH [email protected] 1 participant 1 message Sep 15, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tcp: fix a request socket leak

to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tcp-fix-a-request-socket-leak.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Sep 14 23:20:44 PDT 2017

From: Eric Dumazet <[email protected]>
Date: Fri, 8 Sep 2017 12:44:47 -0700
Subject: tcp: fix a request socket leak

From: Eric Dumazet <[email protected]>

[ Upstream commit 1f3b359f1004bd34b7b0bad70b93e3c7af92a37b ]

While the cited commit fixed a possible deadlock, it added a leak of the request socket, since reqsk_put() must be called if the BPF filter decided the ACK packet must be dropped.

Fixes d624d276d1dd ("tcp: fix possible deadlock in TCP stack vs BPF filter")
---
 net/ipv4/tcp_ipv4.c |    6 +++---
 net/ipv6/tcp_ipv6.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/tcp_ipv4.c +3 -3
@@ -1722,9 +1722,9 @@ process:
 		 */
 		sock_hold(sk);
 		refcounted = true;
-		if (tcp_filter(sk, skb))
-			goto discard_and_relse;
-		nsk = tcp_check_req(sk, skb, req, false);
+		nsk = NULL;
+		if (!tcp_filter(sk, skb))
+			nsk = tcp_check_req(sk, skb, req, false);
 		if (!nsk) {
 			reqsk_put(req);
 			goto discard_and_relse;
net/ipv6/tcp_ipv6.c +3 -3
@@ -1456,9 +1456,9 @@ process:
 		}
 		sock_hold(sk);
 		refcounted = true;
-		if (tcp_filter(sk, skb))
-			goto discard_and_relse;
-		nsk = tcp_check_req(sk, skb, req, false);
+		nsk = NULL;
+		if (!tcp_filter(sk, skb))
+			nsk = tcp_check_req(sk, skb, req, false);
 		if (!nsk) {
 			reqsk_put(req);
 			goto discard_and_relse;

Patches currently in stable-queue which might be from [email protected] are

queue-4.13/ipv6-fix-typo-in-fib6_net_exit.patch queue-4.13/tcp-fix-a-request-socket-leak.patch queue-4.13/udp-drop-head-states-only-when-all-skb-references-are-gone.patch