Commit 62ef81d5 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

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: 4799ac81 ("tls: Add rx inline crypto offload")
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8c03557c
...@@ -904,7 +904,9 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx) ...@@ -904,7 +904,9 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
goto release_netdev; goto release_netdev;
free_sw_resources: free_sw_resources:
up_read(&device_offload_lock);
tls_sw_free_resources_rx(sk); tls_sw_free_resources_rx(sk);
down_read(&device_offload_lock);
release_ctx: release_ctx:
ctx->priv_ctx_rx = NULL; ctx->priv_ctx_rx = NULL;
release_netdev: release_netdev:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment