Skip to content

Commit 62ef81d

Browse files
Jakub Kicinskidavem330
authored andcommitted
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: 4799ac8 ("tls: Add rx inline crypto offload") Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Dirk van der Merwe <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8c03557 commit 62ef81d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/tls/tls_device.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,9 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
904904
goto release_netdev;
905905

906906
free_sw_resources:
907+
up_read(&device_offload_lock);
907908
tls_sw_free_resources_rx(sk);
909+
down_read(&device_offload_lock);
908910
release_ctx:
909911
ctx->priv_ctx_rx = NULL;
910912
release_netdev:

0 commit comments

Comments
 (0)