diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index 1f56225a10e3..3c82286e5bcc 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -1345,7 +1345,10 @@ static int tls_device_down(struct net_device *netdev) /* Device contexts for RX and TX will be freed in on sk_destruct * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW. + * Now release the ref taken above. */ + if (refcount_dec_and_test(&ctx->refcount)) + tls_device_free_ctx(ctx); } up_write(&device_offload_lock);