Skip to content

Commit

Permalink
net: tls: Fix deadlock in free_resources tx
Browse files Browse the repository at this point in the history
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: a42055e ("Add support for async encryption of records...")
Signed-off-by: Dave Watson <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Dave Watson authored and davem330 committed Jan 29, 2019
1 parent 32eb67b commit 1023121
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/tls/tls_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,9 @@ void tls_sw_free_resources_tx(struct sock *sk)
if (atomic_read(&ctx->encrypt_pending))
crypto_wait_req(-EINPROGRESS, &ctx->async_wait);

release_sock(sk);
cancel_delayed_work_sync(&ctx->tx_work.work);
lock_sock(sk);

/* Tx whatever records we can transmit and abandon the rest */
tls_tx_records(sk, -1);
Expand Down

0 comments on commit 1023121

Please sign in to comment.