diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-04-20 01:51:38 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-21 05:35:28 +0200 |
commit | 62ef81d5632634d5e310ed25b9b940b2b6612b46 (patch) | |
tree | 0a1dfa9519bc6bc9a5c0b7d30566c5219ba1c2ad /net/tls | |
parent | selftests/net: correct the return value for run_afpackettests (diff) | |
download | linux-62ef81d5632634d5e310ed25b9b940b2b6612b46.tar.xz linux-62ef81d5632634d5e310ed25b9b940b2b6612b46.zip |
net/tls: avoid potential deadlock in tls_set_device_offload_rx()
If device supports offload, but offload fails tls_set_device_offload_rx()
will call tls_sw_free_resources_rx() which (unhelpfully) releases
and reacquires the socket lock.
For a small fix release and reacquire the device_offload_lock.
Fixes: 4799ac81e52a ("tls: Add rx inline crypto offload")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls')
-rw-r--r-- | net/tls/tls_device.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index 9f3bdbc1e593..1b5f55cac613 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -904,7 +904,9 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx) goto release_netdev; free_sw_resources: + up_read(&device_offload_lock); tls_sw_free_resources_rx(sk); + down_read(&device_offload_lock); release_ctx: ctx->priv_ctx_rx = NULL; release_netdev: |