Skip to content

Commit 7292355

Browse files
Eric Dumazetdavem330
authored andcommitted
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: 079096f ("tcp/dccp: install syn_recv requests into ehash table") Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3720228 commit 7292355

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/ipv4/tcp_ipv4.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,8 +1600,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
16001600
struct sock *nsk = NULL;
16011601

16021602
sk = req->rsk_listener;
1603-
if (tcp_v4_inbound_md5_hash(sk, skb))
1604-
goto discard_and_relse;
1603+
if (unlikely(tcp_v4_inbound_md5_hash(sk, skb))) {
1604+
reqsk_put(req);
1605+
goto discard_it;
1606+
}
16051607
if (likely(sk->sk_state == TCP_LISTEN)) {
16061608
nsk = tcp_check_req(sk, skb, req, false);
16071609
} else {

0 commit comments

Comments
 (0)