Skip to contentSkip to conversation

net/smc: fixes 2020-10-23

PATCH Applied Karsten Graul 2 participants 5 messages Oct 23, 2020 – Oct 26, 2020

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

cover net/smc: fixes 2020-10-23

Please apply the following patch series for smc to netdev's net tree.

Patch 1 fixes a potential null pointer dereference. Patch 2 takes care of a suppressed return code and patch 3 corrects the system EID in the ISM driver.

Karsten Graul (3):
net/smc: fix null pointer dereference in smc_listen_decline() net/smc: fix suppressed return code
s390/ism: fix incorrect system EID

 drivers/s390/net/ism_drv.c | 2 +-
 net/smc/af_smc.c           | 7 ++++---
 net/smc/smc_core.c         | 7 +++++--
 3 files changed, 10 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 net/smc: fix null pointer dereference in smc_listen_decline()

smc_listen_work() calls smc_listen_decline() on label out_decl, providing the ini pointer variable. But this pointer can still be null when the label out_decl is reached.
Fix this by checking the ini variable in smc_listen_work() and call smc_listen_decline() with the result directly.

Fixes a7c9c5f4af7f ("net/smc: CLC accept / confirm V2")
---
 net/smc/af_smc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/smc/af_smc.c +4 -3
index 82be0bd0f6e8..e9f487c8c6d5 100644
@@ -1317,10 +1317,10 @@ static void smc_listen_out_err(struct smc_sock *new_smc)
 
 /* listen worker: decline and fall back if possible */
 static void smc_listen_decline(struct smc_sock *new_smc, int reason_code,
-			       struct smc_init_info *ini, u8 version)
+			       int local_first, u8 version)
 {
 	/* RDMA setup failed, switch back to TCP */
-	if (ini->first_contact_local)
+	if (local_first)
 		smc_lgr_cleanup_early(&new_smc->conn);
 	else
 		smc_conn_free(&new_smc->conn);
@@ -1768,7 +1768,8 @@ static void smc_listen_work(struct work_struct *work)
 out_unlock:
 	mutex_unlock(&smc_server_lgr_pending);
 out_decl:
-	smc_listen_decline(new_smc, rc, ini, version);
+	smc_listen_decline(new_smc, rc, ini ? ini->first_contact_local : 0,
+			   version);
 out_free:
 	kfree(ini);
 	kfree(buf);
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 net/smc: fix suppressed return code

In reply to Karsten Graul

The patch that repaired the invalid return code in smcd_new_buf_create() missed to take care of errno ENOSPC which has a special meaning that no more DMBEs can be registered on the device. Fix that by keeping this errno value during the translation of the return code.

Fixes 6b1bbf94ab36 ("net/smc: fix invalid return code in smcd_new_buf_create()")
---
 net/smc/smc_core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/smc/smc_core.c +5 -2
index d790c43c473f..2b19863f7171 100644
@@ -1615,8 +1615,11 @@ static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr,
 		rc = smc_ism_register_dmb(lgr, bufsize, buf_desc);
 		if (rc) {
 			kfree(buf_desc);
-			return (rc == -ENOMEM) ? ERR_PTR(-EAGAIN) :
-						 ERR_PTR(-EIO);
+			if (rc == -ENOMEM)
+				return ERR_PTR(-EAGAIN);
+			if (rc == -ENOSPC)
+				return ERR_PTR(-ENOSPC);
+			return ERR_PTR(-EIO);
 		}
 		buf_desc->pages = virt_to_page(buf_desc->cpu_addr);
 		/* CDC header stored in buf. So, pretend it was smaller */
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/3 s390/ism: fix incorrect system EID

In reply to Karsten Graul

The system EID that is defined by the ISM driver is not correct. Using an incorrect system EID allows to communicate with remote Linux systems that use the same incorrect system EID, but when it comes to interoperability with other operating systems then the system EIDs do never match which prevents SMC-Dv2 communication.
Using the correct system EID fixes this problem.

Fixes 201091ebb2a1 ("net/smc: introduce System Enterprise ID (SEID)")
---
 drivers/s390/net/ism_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/net/ism_drv.c +1 -1
index fe96ca3c88a5..26cc943d2034 100644
@@ -390,7 +390,7 @@ static int ism_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,
 }
 
 static struct ism_systemeid SYSTEM_EID = {
-	.seid_string = "IBM-SYSZ-IBMSEID00000000",
+	.seid_string = "IBM-SYSZ-ISMSEID00000000",
 	.serial_number = "0000",
 	.type = "0000",
 };
Signature · 1 line
2.17.1
maintainer Applied
#4 lore raw
In reply to Karsten Graul
Quoted 5 lines · On Fri, 23 Oct 2020 20:48:27 +0200 Karsten Graul wrote:

Please apply the following patch series for smc to netdev's net tree.

Patch 1 fixes a potential null pointer dereference. Patch 2 takes care of a suppressed return code and patch 3 corrects the system EID in the ISM driver.

Applied, thanks!