From: Eric Dumazet Date: Fri, 12 Feb 2016 06:50:29 +0000 (-0800) Subject: tcp: md5: release request socket instead of listener X-Git-Tag: firefly_0821_release~176^2~475^2~385 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a4b84d5efbb2aabfb728d717c851eb1e6f521bec;p=firefly-linux-kernel-4.4.55.git tcp: md5: release request socket instead of listener [ Upstream commit 729235554d805c63e5e274fcc6a98e71015dd847 ] If tcp_v4_inbound_md5_hash() returns an error, we must release the refcount on the request socket, not on the listener. The bug was added for IPv4 only. Fixes: 079096f103fac ("tcp/dccp: install syn_recv requests into ehash table") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f66696c51c8c..bfcddee60897 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1597,8 +1597,10 @@ process: struct sock *nsk = NULL; sk = req->rsk_listener; - if (tcp_v4_inbound_md5_hash(sk, skb)) - goto discard_and_relse; + if (unlikely(tcp_v4_inbound_md5_hash(sk, skb))) { + reqsk_put(req); + goto discard_it; + } if (likely(sk->sk_state == TCP_LISTEN)) { nsk = tcp_check_req(sk, skb, req, false); } else {