tls: Correct length of scatterlist in tls_sw_sendpage
authorDave Watson <davejwatson@fb.com>
Fri, 19 Jan 2018 20:30:13 +0000 (12:30 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Jan 2018 21:25:21 +0000 (16:25 -0500)
commit7a8c4dd9be91a7e8f8f0e0419a560663adc694a3
tree99ba58543d67842199c468baff1cac8d272e0c14
parent52acf06451930eb4cefabd5ecea56e2d46c32f76
tls: Correct length of scatterlist in tls_sw_sendpage

The scatterlist is reused by both sendmsg and sendfile.
If a sendmsg of smaller number of pages is followed by a sendfile
of larger number of pages, the scatterlist may be too short, resulting
in a crash in gcm_encrypt.

Add sg_unmark_end to make the list the correct length.

tls_sw_sendmsg already calls sg_unmark_end correctly when it allocates
memory in alloc_sg, or in zerocopy_from_iter.

Signed-off-by: Dave Watson <davejwatson@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c