Skip to content

Commit

Permalink
net/tls: avoid potential deadlock in tls_set_device_offload_rx()
Browse files Browse the repository at this point in the history
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: 4799ac8 ("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>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Apr 21, 2019
1 parent 8c03557 commit 62ef81d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/tls/tls_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 62ef81d

Please sign in to comment.