]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/tls/tls_device.c
tty: drop outdated comments about release_tty() locking
[linux.git] / net / tls / tls_device.c
index 1ba5a92832bb0e065e0e9b8ac6f742b24d1d13c5..1c5574e2e05825140fd4b2ffc2ecd636147aba63 100644 (file)
@@ -593,7 +593,7 @@ struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context,
                                       u32 seq, u64 *p_record_sn)
 {
        u64 record_sn = context->hint_record_sn;
-       struct tls_record_info *info;
+       struct tls_record_info *info, *last;
 
        info = context->retransmit_hint;
        if (!info ||
@@ -605,6 +605,24 @@ struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context,
                                                struct tls_record_info, list);
                if (!info)
                        return NULL;
+               /* send the start_marker record if seq number is before the
+                * tls offload start marker sequence number. This record is
+                * required to handle TCP packets which are before TLS offload
+                * started.
+                *  And if it's not start marker, look if this seq number
+                * belongs to the list.
+                */
+               if (likely(!tls_record_is_start_marker(info))) {
+                       /* we have the first record, get the last record to see
+                        * if this seq number belongs to the list.
+                        */
+                       last = list_last_entry(&context->records_list,
+                                              struct tls_record_info, list);
+
+                       if (!between(seq, tls_record_start_seq(info),
+                                    last->end_seq))
+                               return NULL;
+               }
                record_sn = context->unacked_record_sn;
        }