mirror-linux/include
Jakub Kicinski b93235e689 tls: cap the output scatter list to something reasonable
TLS recvmsg() passes user pages as destination for decrypt.
The decrypt operation is repeated record by record, each
record being 16kB, max. TLS allocates an sg_table and uses
iov_iter_get_pages() to populate it with enough pages to
fit the decrypted record.

Even though we decrypt a single message at a time we size
the sg_table based on the entire length of the iovec.
This leads to unnecessarily large allocations, risking
triggering OOM conditions.

Use iov_iter_truncate() / iov_iter_reexpand() to construct
a "capped" version of iov_iter_npages(). Alternatively we
could parametrize iov_iter_npages() to take the size as
arg instead of using i->count, or do something else..

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-04 10:14:07 +00:00
..
acpi
asm-generic bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
clocksource
crypto
drm
dt-bindings
keys
kunit
kvm
linux tls: cap the output scatter list to something reasonable 2022-02-04 10:14:07 +00:00
math-emu
media
memory
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-03 17:36:16 -08:00
pcmcia
ras
rdma
scsi Merge branch 'akpm' (patches from Andrew) 2022-01-22 11:28:23 +02:00
soc
sound
target
trace Tracing fixes for 5.17-rc1: 2022-01-28 19:30:35 +02:00
uapi Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-03 17:36:16 -08:00
vdso
video
xen