hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/net/smc/af_smc.c
....@@ -1988,16 +1988,14 @@
19881988 {
19891989 struct sock *sk = sock->sk;
19901990 struct smc_sock *smc;
1991
- int rc = -EPIPE;
1991
+ int rc;
19921992
19931993 smc = smc_sk(sk);
19941994 lock_sock(sk);
1995
- if ((sk->sk_state != SMC_ACTIVE) &&
1996
- (sk->sk_state != SMC_APPCLOSEWAIT1) &&
1997
- (sk->sk_state != SMC_INIT))
1998
- goto out;
19991995
1996
+ /* SMC does not support connect with fastopen */
20001997 if (msg->msg_flags & MSG_FASTOPEN) {
1998
+ /* not connected yet, fallback */
20011999 if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) {
20022000 smc_switch_to_fallback(smc);
20032001 smc->fallback_rsn = SMC_CLC_DECL_OPTUNSUPP;
....@@ -2005,6 +2003,11 @@
20052003 rc = -EINVAL;
20062004 goto out;
20072005 }
2006
+ } else if ((sk->sk_state != SMC_ACTIVE) &&
2007
+ (sk->sk_state != SMC_APPCLOSEWAIT1) &&
2008
+ (sk->sk_state != SMC_INIT)) {
2009
+ rc = -EPIPE;
2010
+ goto out;
20082011 }
20092012
20102013 if (smc->use_fallback)