]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/tls/tls_main.c
Merge tag 'mlx5-fixes-2019-12-05' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / net / tls / tls_main.c
index bdca31ffe6da7c7102c29f1f98193c6077ecb5e0..dac24c7aa7d4bb45b3188dae3fb1f6030cd3c299 100644 (file)
@@ -209,24 +209,15 @@ int tls_push_partial_record(struct sock *sk, struct tls_context *ctx,
        return tls_push_sg(sk, ctx, sg, offset, flags);
 }
 
-bool tls_free_partial_record(struct sock *sk, struct tls_context *ctx)
+void tls_free_partial_record(struct sock *sk, struct tls_context *ctx)
 {
        struct scatterlist *sg;
 
-       sg = ctx->partially_sent_record;
-       if (!sg)
-               return false;
-
-       while (1) {
+       for (sg = ctx->partially_sent_record; sg; sg = sg_next(sg)) {
                put_page(sg_page(sg));
                sk_mem_uncharge(sk, sg->length);
-
-               if (sg_is_last(sg))
-                       break;
-               sg++;
        }
        ctx->partially_sent_record = NULL;
-       return true;
 }
 
 static void tls_write_space(struct sock *sk)
@@ -496,7 +487,7 @@ static int do_tls_setsockopt_conf(struct sock *sk, char __user *optval,
        /* check version */
        if (crypto_info->version != TLS_1_2_VERSION &&
            crypto_info->version != TLS_1_3_VERSION) {
-               rc = -ENOTSUPP;
+               rc = -EINVAL;
                goto err_crypto_info;
        }
 
@@ -723,7 +714,7 @@ static int tls_init(struct sock *sk)
         * share the ulp context.
         */
        if (sk->sk_state != TCP_ESTABLISHED)
-               return -ENOTSUPP;
+               return -ENOTCONN;
 
        /* allocate tls context */
        write_lock_bh(&sk->sk_callback_lock);