mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work
[ Upstream commita18cee4791] 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:b286a0651e("net/smc: handle incoming CDC validation message") Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8a00c832ef
commit
b4561bd29e
@@ -1089,7 +1089,9 @@ static void smc_conn_abort_work(struct work_struct *work)
|
|||||||
abort_work);
|
abort_work);
|
||||||
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
|
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
|
||||||
|
|
||||||
|
lock_sock(&smc->sk);
|
||||||
smc_conn_kill(conn, true);
|
smc_conn_kill(conn, true);
|
||||||
|
release_sock(&smc->sk);
|
||||||
sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */
|
sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user