* [PATCH net] net: tls: Fix deadlock in free_resources tx
@ 2019-01-27 0:59 Dave Watson
2019-01-29 7:07 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dave Watson @ 2019-01-27 0:59 UTC (permalink / raw)
To: netdev@vger.kernel.org, Dave Miller
Cc: Vakul Garg, Boris Pismenny, Aviad Yehezkel, John Fastabend,
Daniel Borkmann
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: a42055e8d2c30 ("Add support for async encryption of records...")
Signed-off-by: Dave Watson <davejwatson@fb.com>
---
net/tls/tls_sw.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 7e963560edef..bf5b54b513bc 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: tls: Fix deadlock in free_resources tx
2019-01-27 0:59 [PATCH net] net: tls: Fix deadlock in free_resources tx Dave Watson
@ 2019-01-29 7:07 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-01-29 7:07 UTC (permalink / raw)
To: davejwatson; +Cc: netdev, vakul.garg, borisp, aviadye, john.fastabend, daniel
From: Dave Watson <davejwatson@fb.com>
Date: Sun, 27 Jan 2019 00:59:03 +0000
> 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: a42055e8d2c30 ("Add support for async encryption of records...")
> Signed-off-by: Dave Watson <davejwatson@fb.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-29 7:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-27 0:59 [PATCH net] net: tls: Fix deadlock in free_resources tx Dave Watson
2019-01-29 7:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).