crypto/chtls: fix tls alert messages corrupted by tls data
authorVinay Kumar Yadav <vinay.yadav@chelsio.com>
Fri, 17 Jul 2020 19:01:42 +0000 (00:31 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 01:27:40 +0000 (18:27 -0700)
When tls data skb is pending for Tx and tls alert comes , It
is wrongly overwrite the record type of tls data to tls alert
record type. fix the issue correcting it.

v1->v2:
- Correct submission tree.
- Add fixes tag.

Fixes: 6919a8264a32 ("Crypto/chtls: add/delete TLS header in driver")
Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/crypto/chelsio/chtls/chtls_io.c

index e1401d9..2e9acae 100644 (file)
@@ -1052,14 +1052,15 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
                                                          &record_type);
                                if (err)
                                        goto out_err;
+
+                               /* Avoid appending tls handshake, alert to tls data */
+                               if (skb)
+                                       tx_skb_finalize(skb);
                        }
 
                        recordsz = size;
                        csk->tlshws.txleft = recordsz;
                        csk->tlshws.type = record_type;
-
-                       if (skb)
-                               ULP_SKB_CB(skb)->ulp.tls.type = record_type;
                }
 
                if (!skb || (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND) ||