Skip to content

Commit

Permalink
ch_ktls: Correction in trimmed_len calculation
Browse files Browse the repository at this point in the history
trimmed length calculation goes wrong if skb has only tag part
to send. It should be zero if there is no data bytes apart from
TAG.

Fixes: dc05f3d ("chcr: Handle first or middle part of record")
Signed-off-by: Rohit Maheshwari <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
rmchelsio authored and kuba-moo committed Nov 12, 2020
1 parent 687823d commit c68a28a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1729,10 +1729,13 @@ static int chcr_short_record_handler(struct chcr_ktls_info *tx_info,

if (remaining_record > 0 &&
remaining_record < TLS_CIPHER_AES_GCM_128_TAG_SIZE) {
int trimmed_len = data_len -
(TLS_CIPHER_AES_GCM_128_TAG_SIZE - remaining_record);
/* don't process the pkt if it is only a partial tag */
if (data_len < TLS_CIPHER_AES_GCM_128_TAG_SIZE)
int trimmed_len = 0;

if (tls_end_offset > TLS_CIPHER_AES_GCM_128_TAG_SIZE)
trimmed_len = data_len -
(TLS_CIPHER_AES_GCM_128_TAG_SIZE -
remaining_record);
if (!trimmed_len)
goto out;

WARN_ON(trimmed_len > data_len);
Expand Down

0 comments on commit c68a28a

Please sign in to comment.