Commit cd206360 authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller
Browse files

net/smc: avoid fallback in case of non-blocking connect

FASTOPEN is not possible with SMC. sendmsg() with msg_flag MSG_FASTOPEN
triggers a fallback to TCP if the socket is in state SMC_INIT.
But if a nonblocking connect is already started, fallback to TCP
is no longer possible, even though the socket may still be in state
And if a nonblocking connect is already started, a listen() call
does not make sense.

Reported-by: default avatar <>
Fixes: 50717a37

 ("net/smc: nonblocking connect rework")
Signed-off-by: default avatarUrsula Braun <>
Signed-off-by: default avatarKarsten Graul <>
Signed-off-by: default avatarDavid S. Miller <>
parent f9cedf1a
......@@ -263,7 +263,7 @@ static int smc_bind(struct socket *sock, struct sockaddr *uaddr,
/* Check if socket is already active */
rc = -EINVAL;
if (sk->sk_state != SMC_INIT)
if (sk->sk_state != SMC_INIT || smc->connect_nonblock)
goto out_rel;
smc->clcsock->sk->sk_reuse = sk->sk_reuse;
......@@ -1390,7 +1390,8 @@ static int smc_listen(struct socket *sock, int backlog)
rc = -EINVAL;
if ((sk->sk_state != SMC_INIT) && (sk->sk_state != SMC_LISTEN))
if ((sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) ||
goto out;
rc = 0;
......@@ -1518,7 +1519,7 @@ static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
goto out;
if (msg->msg_flags & MSG_FASTOPEN) {
if (sk->sk_state == SMC_INIT) {
if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) {
smc->fallback_rsn = SMC_CLC_DECL_OPTUNSUPP;
} else {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment