Skip to content

Commit 877d17c

Browse files
qsndavem330
authored andcommitted
tls: return -EBUSY if crypto_info is already set
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 <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cf6d43e commit 877d17c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/tls/tls_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,10 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
367367

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

373375
rc = copy_from_user(crypto_info, optval, sizeof(*crypto_info));
374376
if (rc) {

0 commit comments

Comments
 (0)