]> git.baikalelectronics.ru Git - kernel.git/commit
net/tls: fix lowat calculation if some data came from previous record
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 24 May 2019 17:34:30 +0000 (10:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 May 2019 04:47:12 +0000 (21:47 -0700)
commit182d48009059b1747ea1e6a3fdc16e11b0bb301a
treee0ed795da6a44b4882c183b631e33f3e52169006
parentb78aaac406830dbec629e40b5b64d1b8e1390b7a
net/tls: fix lowat calculation if some data came from previous record

If some of the data came from the previous record, i.e. from
the rx_list it had already been decrypted, so it's not counted
towards the "decrypted" variable, but the "copied" variable.
Take that into account when checking lowat.

When calculating lowat target we need to pass the original len.
E.g. if lowat is at 80, len is 100 and we had 30 bytes on rx_list
target would currently be incorrectly calculated as 70, even though
we only need 50 more bytes to make up the 80.

Fixes: b359aa1a348b ("tls: Fix recvmsg() to be able to peek across multiple records")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Tested-by: David Beckett <david.beckett@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c