]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/tls: fix the IV leaks
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 10 Apr 2019 18:04:30 +0000 (11:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Apr 2019 20:07:02 +0000 (13:07 -0700)
Commit 782dcbba4521 ("net/tls: Split conf to rx + tx") made
freeing of IV and record sequence number conditional to SW
path only, but commit 70330c44d303 ("net/tls: Add generic NIC
offload infrastructure") also allocates that state for the
device offload configuration.  Remember to free it.

Fixes: 70330c44d303 ("net/tls: Add generic NIC offload infrastructure")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_device.c

index 135a7ee9db034149252f8df3a56f7834ff573eab..38b3b2a9835aa2cd13fc7c03c9b382cea3b2aba5 100644 (file)
@@ -52,8 +52,11 @@ static DEFINE_SPINLOCK(tls_device_lock);
 
 static void tls_device_free_ctx(struct tls_context *ctx)
 {
-       if (ctx->tx_conf == TLS_HW)
+       if (ctx->tx_conf == TLS_HW) {
                kfree(tls_offload_ctx_tx(ctx));
+               kfree(ctx->tx.rec_seq);
+               kfree(ctx->tx.iv);
+       }
 
        if (ctx->rx_conf == TLS_HW)
                kfree(tls_offload_ctx_rx(ctx));