Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f3b359f authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: d624d276 ("tcp: fix possible deadlock in TCP stack vs BPF filter")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10807461
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1669,8 +1669,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
		 */
		sock_hold(sk);
		refcounted = true;
		if (tcp_filter(sk, skb))
			goto discard_and_relse;
		nsk = NULL;
		if (!tcp_filter(sk, skb))
			nsk = tcp_check_req(sk, skb, req, false);
		if (!nsk) {
			reqsk_put(req);
+3 −3
Original line number Diff line number Diff line
@@ -1460,8 +1460,8 @@ static int tcp_v6_rcv(struct sk_buff *skb)
		}
		sock_hold(sk);
		refcounted = true;
		if (tcp_filter(sk, skb))
			goto discard_and_relse;
		nsk = NULL;
		if (!tcp_filter(sk, skb))
			nsk = tcp_check_req(sk, skb, req, false);
		if (!nsk) {
			reqsk_put(req);