Skip to content

Commit 257082e

Browse files
Boris Pismennydavem330
Boris Pismenny
authored andcommitted
tls: reset the crypto info if copy_from_user fails
copy_from_user could copy some partial information, as a result TLS_CRYPTO_INFO_READY(crypto_info) could be true while crypto_info is using uninitialzed data. This patch resets crypto_info when copy_from_user fails. fixes: 3c4d755 ("tls: kernel TLS support") Signed-off-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a1dfa68 commit 257082e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tls/tls_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
376376
rc = copy_from_user(crypto_info, optval, sizeof(*crypto_info));
377377
if (rc) {
378378
rc = -EFAULT;
379-
goto out;
379+
goto err_crypto_info;
380380
}
381381

382382
/* check version */

0 commit comments

Comments
 (0)