diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 961b07d4d41ca7a677b1fd0d24f490888d784e0a..b61b893e9204f266ce200430f03bbb8d4497bf87 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -874,7 +874,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: