summaryrefslogtreecommitdiffstats
path: root/net/tls/tls_device.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-07-21 22:03:39 +0200
committerJakub Kicinski <kuba@kernel.org>2022-07-21 22:03:39 +0200
commit6e0e846ee2ab01bc44254e6a0a6a6a0db1cba16d (patch)
treee2a39b9ff9fbfa9adbaa004e3b42047664a8e57d /net/tls/tls_device.c
parentnet/cdc_ncm: Increase NTB max RX/TX values to 64kb (diff)
parentMerge tag 'net-5.19-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff)
downloadlinux-6e0e846ee2ab01bc44254e6a0a6a6a0db1cba16d.tar.xz
linux-6e0e846ee2ab01bc44254e6a0a6a6a0db1cba16d.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/tls/tls_device.c')
-rw-r--r--net/tls/tls_device.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 6abbe3c2520c..b1fcd61836d1 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -98,13 +98,16 @@ static void tls_device_queue_ctx_destruction(struct tls_context *ctx)
unsigned long flags;
spin_lock_irqsave(&tls_device_lock, flags);
+ if (unlikely(!refcount_dec_and_test(&ctx->refcount)))
+ goto unlock;
+
list_move_tail(&ctx->list, &tls_device_gc_list);
/* schedule_work inside the spinlock
* to make sure tls_device_down waits for that work.
*/
schedule_work(&tls_device_gc_work);
-
+unlock:
spin_unlock_irqrestore(&tls_device_lock, flags);
}
@@ -195,8 +198,7 @@ void tls_device_sk_destruct(struct sock *sk)
clean_acked_data_disable(inet_csk(sk));
}
- if (refcount_dec_and_test(&tls_ctx->refcount))
- tls_device_queue_ctx_destruction(tls_ctx);
+ tls_device_queue_ctx_destruction(tls_ctx);
}
EXPORT_SYMBOL_GPL(tls_device_sk_destruct);