HomeFreeBSD

tcp: Disallow re-connection of a connected socket

Description

tcp: Disallow re-connection of a connected socket

soconnectat() tries to ensure that one cannot connect a connected
socket. However, the check is racy and does not really prevent two
threads from attempting to connect the same TCP socket.

Modify tcp_connect() and tcp6_connect() to perform the check again, this
time synchronized by the inpcb lock, under which we call
soisconnecting().

Reported by: syzkaller
Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38507

Details

Provenance
markjAuthored on Feb 14 2023, 2:27 PM
Reviewer
glebius
Differential Revision
D38507: tcp: Disallow re-connection of a connected socket
Parents
rG825fbd087e61: linux(4): Trim unused opt_usb.h from modules Makefiles
Branches
Unknown
Tags
Unknown