diff options
author | Eric Dumazet <edumazet@google.com> | 2016-02-11 22:50:29 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-16 20:24:06 -0500 |
commit | 729235554d805c63e5e274fcc6a98e71015dd847 (patch) | |
tree | 04ecded263a2d8274d32c2832368a92f69e3a25d /net/ipv4 | |
parent | 372022830b06d9980c7e8b41fa0a4081cff883b0 (diff) | |
download | linux-729235554d805c63e5e274fcc6a98e71015dd847.tar.bz2 |
tcp: md5: release request socket instead of listener
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 <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 7f6ff037adaf..c84477949d3a 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1600,8 +1600,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 { |