Skip to content

Commit 8204df7

Browse files
Ursula Braundavem330
authored andcommitted
net/smc: fix fastopen for non-blocking connect()
FASTOPEN does not work with SMC-sockets. Since SMC allows fallback to TCP native during connection start, the FASTOPEN setsockopts trigger this fallback, if the SMC-socket is still in state SMC_INIT. But if a FASTOPEN setsockopt is called after a non-blocking connect(), this is broken, and fallback does not make sense. This change complements commit cd20636 ("net/smc: avoid fallback in case of non-blocking connect") and fixes the syzbot reported problem "WARNING in smc_unhash_sk". Reported-by: [email protected] Fixes: e1bbdd5 ("net/smc: reduce sock_put() for fallback sockets") Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: Karsten Graul <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a36e629 commit 8204df7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/smc/af_smc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
17321732
case TCP_FASTOPEN_KEY:
17331733
case TCP_FASTOPEN_NO_COOKIE:
17341734
/* option not supported by SMC */
1735-
if (sk->sk_state == SMC_INIT) {
1735+
if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) {
17361736
smc_switch_to_fallback(smc);
17371737
smc->fallback_rsn = SMC_CLC_DECL_OPTUNSUPP;
17381738
} else {

0 commit comments

Comments
 (0)