Skip to contentSkip to conversation

net/smc: fixes for -net

PATCH In review Karsten Graul 2 participants 4 messages Feb 14, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net/smc: fixes for -net

Fix a syzbot finding and a problem with the CLC handshake content.

Ursula Braun (2):
net/smc: transfer fasync_list in case of fallback net/smc: no peer ID in CLC decline for SMCD

 net/smc/af_smc.c  | 2 ++
 net/smc/smc_clc.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 net/smc: transfer fasync_list in case of fallback

From: Ursula Braun <[email protected]>

SMC does not work together with FASTOPEN. If sendmsg() is called with flag MSG_FASTOPEN in SMC_INIT state, the SMC-socket switches to fallback mode. To handle the previous ioctl FIOASYNC call correctly in this case, it is necessary to transfer the socket wait queue fasync_list to the internal TCP socket.

Reported-by [email protected]
Fixes ee9dfbef02d18 ("net/smc: handle sockopts forcing fallback")
---
 net/smc/af_smc.c | 2 ++
 1 file changed, 2 insertions(+)
net/smc/af_smc.c +2 -0
index cee5bf4a9bb9..90988a511cd5 100644
@@ -470,6 +470,8 @@ static void smc_switch_to_fallback(struct smc_sock *smc)
 	if (smc->sk.sk_socket && smc->sk.sk_socket->file) {
 		smc->clcsock->file = smc->sk.sk_socket->file;
 		smc->clcsock->file->private_data = smc->clcsock;
+		smc->clcsock->wq.fasync_list =
+			smc->sk.sk_socket->wq.fasync_list;
 	}
 }
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 net/smc: no peer ID in CLC decline for SMCD

In reply to Karsten Graul

From: Ursula Braun <[email protected]>

Just SMCR requires a CLC Peer ID, but not SMCD. The field should be zero for SMCD.

Fixes c758dfddc1b5 ("net/smc: add SMC-D support in CLC messages")
---
 net/smc/smc_clc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/smc/smc_clc.c +3 -1
index 0879f7bed967..86cccc24e52e 100644
@@ -372,7 +372,9 @@ int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info)
 	dclc.hdr.length = htons(sizeof(struct smc_clc_msg_decline));
 	dclc.hdr.version = SMC_CLC_V1;
 	dclc.hdr.flag = (peer_diag_info == SMC_CLC_DECL_SYNCERR) ? 1 : 0;
-	memcpy(dclc.id_for_peer, local_systemid, sizeof(local_systemid));
+	if (smc->conn.lgr && !smc->conn.lgr->is_smcd)
+		memcpy(dclc.id_for_peer, local_systemid,
+		       sizeof(local_systemid));
 	dclc.peer_diagnosis = htonl(peer_diag_info);
 	memcpy(dclc.trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER));
 
Signature · 1 line
2.17.1