Skip to contentSkip to conversation

net/smc: fix 2020-09-17

PATCH Applied Karsten Graul 2 participants 3 messages Sep 17, 2020 – Sep 18, 2020

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

cover net/smc: fix 2020-09-17

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

The patch fixes a problem reported by Dan. Because the fixed patch is still only in net-next tree I am sending this fix to net-next.

Ursula Braun (1):
net/smc: fix double kfree in smc_listen_work()

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

PATCH 1/1 net/smc: fix double kfree in smc_listen_work()

From: Ursula Braun <[email protected]>

If smc_listen_rmda_finish() returns with an error, the storage addressed by 'buf' is freed a second time.
Consolidate freeing under a common label and jump to that label.

Fixes 6bb14e48ee8d ("net/smc: dynamic allocation of CLC proposal buffer")
---
 net/smc/af_smc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/af_smc.c +2 -2
index f5bececfedaa..ed8f97166be9 100644
@@ -1371,7 +1371,6 @@ static void smc_listen_work(struct work_struct *work)
 	}
 
 	/* finish worker */
-	kfree(buf);
 	if (!ism_supported) {
 		rc = smc_listen_rdma_finish(new_smc, &cclc,
 					    ini.first_contact_local);
@@ -1381,12 +1380,13 @@ static void smc_listen_work(struct work_struct *work)
 	}
 	smc_conn_save_peer_info(new_smc, &cclc);
 	smc_listen_out_connected(new_smc);
-	return;
+	goto out_free;
 
 out_unlock:
 	mutex_unlock(&smc_server_lgr_pending);
 out_decl:
 	smc_listen_decline(new_smc, rc, ini.first_contact_local);
+out_free:
 	kfree(buf);
 }
 
Signature · 1 line
2.17.1
maintainer Applied
#2 lore raw

Re: [PATCH net-next 1/1] net/smc: fix double kfree in smc_listen_work()

From: Karsten Graul <[email protected]>
Date: Thu, 17 Sep 2020 22:46:02 +0200

Quoted 10 lines

From: Ursula Braun <[email protected]>

If smc_listen_rmda_finish() returns with an error, the storage addressed by 'buf' is freed a second time.
Consolidate freeing under a common label and jump to that label.

Fixes 6bb14e48ee8d ("net/smc: dynamic allocation of CLC proposal buffer")

Applied.