Skip to contentSkip to conversation

net/smc: keep clcsock reference in smc_tcp_listen_work()

PATCH In review Ursula Braun 2 participants 2 messages Apr 25, 2018

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

PATCH 1/1 net/smc: keep clcsock reference in smc_tcp_listen_work()

The internal CLC socket should exist till the SMC-socket is released. Function tcp_listen_worker() releases the internal CLC socket of a listen socket, if an smc_close_active() is called. This function is called for the final release(), but it is called for shutdown SHUT_RDWR as well. This opens a door for protection faults, if socket calls using the internal CLC socket are called for a shutdown listen socket.

With the changes of
commit 3d502067599f ("net/smc: simplify wait when closing listen socket") there is no need anymore to release the internal CLC socket in function tcp_listen_worker((). It is sufficient to release it in smc_release().

Fixes 127f49705823 ("net/smc: release clcsock from tcp_listen_worker")
Reported-by [email protected]
Reported-by [email protected]
Reported-by [email protected]
Reported-by [email protected]
---
 net/smc/af_smc.c | 4 ----
 1 file changed, 4 deletions(-)
net/smc/af_smc.c +0 -4
index f5d4b69dbabc..4470501374bf 100644
@@ -978,10 +978,6 @@ static void smc_tcp_listen_work(struct work_struct *work)
 	}
 
 out:
-	if (lsmc->clcsock) {
-		sock_release(lsmc->clcsock);
-		lsmc->clcsock = NULL;
-	}
 	release_sock(lsk);
 	sock_put(&lsmc->sk); /* sock_hold in smc_listen */
 }
Signature · 1 line
2.13.5
maintainer
#1 lore raw

From: Ursula Braun <[email protected]>
Date: Wed, 25 Apr 2018 12:48:58 +0200

Quoted 14 lines

The internal CLC socket should exist till the SMC-socket is released. Function tcp_listen_worker() releases the internal CLC socket of a listen socket, if an smc_close_active() is called. This function is called for the final release(), but it is called for shutdown SHUT_RDWR as well. This opens a door for protection faults, if socket calls using the internal CLC socket are called for a shutdown listen socket.

With the changes of
commit 3d502067599f ("net/smc: simplify wait when closing listen socket") there is no need anymore to release the internal CLC socket in function tcp_listen_worker((). It is sufficient to release it in smc_release().

Quoted 6 lines
Fixes 127f49705823 ("net/smc: release clcsock from tcp_listen_worker")
Reported-by [email protected]
Reported-by [email protected]
Reported-by [email protected]
Reported-by [email protected]

Applied and queued up for -stable.