mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
net: tls: Fix deadlock in free_resources tx
If there are outstanding async tx requests (when crypto returns EINPROGRESS),
there is a potential deadlock: the tx work acquires the lock, while we
cancel_delayed_work_sync() while holding the lock. Drop the lock while waiting
for the work to complete.
Fixes: a42055e8d2
("Add support for async encryption of records...")
Signed-off-by: Dave Watson <davejwatson@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
32eb67b93c
commit
1023121375
1 changed files with 2 additions and 0 deletions
|
@ -1794,7 +1794,9 @@ void tls_sw_free_resources_tx(struct sock *sk)
|
||||||
if (atomic_read(&ctx->encrypt_pending))
|
if (atomic_read(&ctx->encrypt_pending))
|
||||||
crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
|
crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
|
||||||
|
|
||||||
|
release_sock(sk);
|
||||||
cancel_delayed_work_sync(&ctx->tx_work.work);
|
cancel_delayed_work_sync(&ctx->tx_work.work);
|
||||||
|
lock_sock(sk);
|
||||||
|
|
||||||
/* Tx whatever records we can transmit and abandon the rest */
|
/* Tx whatever records we can transmit and abandon the rest */
|
||||||
tls_tx_records(sk, -1);
|
tls_tx_records(sk, -1);
|
||||||
|
|
Loading…
Reference in a new issue