Skip to content

Commit a18cee4

Browse files
karstengrdavem330
authored andcommitted
net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work
The abort_work is scheduled when a connection was detected to be out-of-sync after a link failure. The work calls smc_conn_kill(), which calls smc_close_active_abort() and that might end up calling smc_close_cancel_work(). smc_close_cancel_work() cancels any pending close_work and tx_work but needs to release the sock_lock before and acquires the sock_lock again afterwards. So when the sock_lock was NOT acquired before then it may be held after the abort_work completes. Thats why the sock_lock is acquired before the call to smc_conn_kill() in __smc_lgr_terminate(), but this is missing in smc_conn_abort_work(). Fix that by acquiring the sock_lock first and release it after the call to smc_conn_kill(). Fixes: b286a06 ("net/smc: handle incoming CDC validation message") Signed-off-by: Karsten Graul <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6c90731 commit a18cee4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/smc/smc_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,9 @@ static void smc_conn_abort_work(struct work_struct *work)
14741474
abort_work);
14751475
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
14761476

1477+
lock_sock(&smc->sk);
14771478
smc_conn_kill(conn, true);
1479+
release_sock(&smc->sk);
14781480
sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */
14791481
}
14801482

0 commit comments

Comments
 (0)