]> git.baikalelectronics.ru Git - kernel.git/commit
tls: Fix recvmsg() to be able to peek across multiple records
authorVakul Garg <vakul.garg@nxp.com>
Wed, 16 Jan 2019 10:40:16 +0000 (10:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Jan 2019 22:20:40 +0000 (14:20 -0800)
commit7839f6354be0d2129cbe5428dcb549cb9fb9ee2d
treeeec9d65c6440f10cdbefa4d329e3a425babc5456
parent17d01d0e372124ef0e907435eff77284f7b1148c
tls: Fix recvmsg() to be able to peek across multiple records

This fixes recvmsg() to be able to peek across multiple tls records.
Without this patch, the tls's selftests test case
'recv_peek_large_buf_mult_recs' fails. Each tls receive context now
maintains a 'rx_list' to retain incoming skb carrying tls records. If a
tls record needs to be retained e.g. for peek case or for the case when
the buffer passed to recvmsg() has a length smaller than decrypted
record length, then it is added to 'rx_list'. Additionally, records are
added in 'rx_list' if the crypto operation runs in async mode. The
records are dequeued from 'rx_list' after the decrypted data is consumed
by copying into the buffer passed to recvmsg(). In case, the MSG_PEEK
flag is used in recvmsg(), then records are not consumed or removed
from the 'rx_list'.

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tls.h
net/tls/tls_sw.c