]> git.hungrycats.org Git - linux/commitdiff
tls: clear key material from kernel memory when do_tls_setsockopt_conf fails
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 12 Sep 2018 15:44:43 +0000 (17:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Sep 2018 09:55:52 +0000 (02:55 -0700)
[ Upstream commit c844eb46b7d43c2cf760169df5ae1d5b033af338 ]

Fixes: 3c4d7559159b ("tls: kernel TLS support")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/tls/tls_main.c

index 4e28210e0343237e24c50ef188db5391de5756bc..2ccf194c3ebb72892963b72457b1cd16f5ce5219 100644 (file)
@@ -502,7 +502,7 @@ static int do_tls_setsockopt_conf(struct sock *sk, char __user *optval,
        goto out;
 
 err_crypto_info:
-       memset(crypto_info, 0, sizeof(*crypto_info));
+       memzero_explicit(crypto_info, sizeof(union tls_crypto_context));
 out:
        return rc;
 }