Skip to content

Commit

Permalink
tls: return -EBUSY if crypto_info is already set
Browse files Browse the repository at this point in the history
do_tls_setsockopt_tx returns 0 without doing anything when crypto_info
is already set. Silent failure is confusing for users.

Fixes: 3c4d755 ("tls: kernel TLS support")
Signed-off-by: Sabrina Dubroca <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
qsn authored and davem330 committed Jan 17, 2018
1 parent cf6d43e commit 877d17c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/tls/tls_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,10 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,

crypto_info = &ctx->crypto_send;
/* Currently we don't support set crypto info more than one time */
if (TLS_CRYPTO_INFO_READY(crypto_info))
if (TLS_CRYPTO_INFO_READY(crypto_info)) {
rc = -EBUSY;
goto out;
}

rc = copy_from_user(crypto_info, optval, sizeof(*crypto_info));
if (rc) {
Expand Down

0 comments on commit 877d17c

Please sign in to comment.