summaryrefslogtreecommitdiff
path: root/net/tls/tls_sw.c
diff options
context:
space:
mode:
authorVakul Garg <vakul.garg@nxp.com>2018-08-02 18:13:10 +0300
committerDavid S. Miller <davem@davemloft.net>2018-08-06 03:13:58 +0300
commitcfb4099fb4c101dad283a163c9525240ef4a1a99 (patch)
treee6c8532e6359aee59c7f30029548f08535d69812 /net/tls/tls_sw.c
parent5f379ef51bc967567bbddacdcdecb772d4d7c3b3 (diff)
downloadlinux-cfb4099fb4c101dad283a163c9525240ef4a1a99.tar.xz
net/tls: Mark the end in scatterlist table
Function zerocopy_from_iter() unmarks the 'end' in input sgtable while adding new entries in it. The last entry in sgtable remained unmarked. This results in KASAN error report on using apis like sg_nents(). Before returning, the function needs to mark the 'end' in the last entry it adds. Signed-off-by: Vakul Garg <vakul.garg@nxp.com> Acked-by: Dave Watson <davejwatson@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls/tls_sw.c')
-rw-r--r--net/tls/tls_sw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index ff3a6904a722..83d67df33f0c 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -311,6 +311,9 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from,
}
}
+ /* Mark the end in the last sg entry if newly added */
+ if (num_elem > *pages_used)
+ sg_mark_end(&to[num_elem - 1]);
out:
if (rc)
iov_iter_revert(from, size - *size_used);