UPSTREAM: tcp: fix a request socket leak

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")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1f3b359f1004bd34b7b0bad70b93e3c7af92a37b)

Bug: 30950746
Change-Id: I59a1f0c70925ee4bd93ac277d785759958bd2b9e
This commit is contained in:
Eric Dumazet
2017-09-08 12:44:47 -07:00
committed by Chenbo Feng
parent 2c5c4ccd96
commit 9c3804bc9b
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -1678,9 +1678,9 @@ process:
*/ */
sock_hold(sk); sock_hold(sk);
refcounted = true; refcounted = true;
if (tcp_filter(sk, skb)) nsk = NULL;
goto discard_and_relse; if (!tcp_filter(sk, skb))
nsk = tcp_check_req(sk, skb, req, false); nsk = tcp_check_req(sk, skb, req, false);
if (!nsk) { if (!nsk) {
reqsk_put(req); reqsk_put(req);
goto discard_and_relse; goto discard_and_relse;
+3 -3
View File
@@ -1442,9 +1442,9 @@ process:
} }
sock_hold(sk); sock_hold(sk);
refcounted = true; refcounted = true;
if (tcp_filter(sk, skb)) nsk = NULL;
goto discard_and_relse; if (!tcp_filter(sk, skb))
nsk = tcp_check_req(sk, skb, req, false); nsk = tcp_check_req(sk, skb, req, false);
if (!nsk) { if (!nsk) {
reqsk_put(req); reqsk_put(req);
goto discard_and_relse; goto discard_and_relse;