aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-07-23 16:37:54 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-24 00:28:45 -0400
commit144fe2bfd236dc814eae587aea7e2af03dbdd755 (patch)
tree75dfd88c50706a78d0fafdfbc8b6760d138099a7
parent1a4f14bab1868b443f0dd3c55b689a478f82e72e (diff)
sock: fix sg page frag coalescing in sk_alloc_sg
Current sg coalescing logic in sk_alloc_sg() (latter is used by tls and sockmap) is not quite correct in that we do fetch the previous sg entry, however the subsequent check whether the refilled page frag from the socket is still the same as from the last entry with prior offset and length matching the start of the current buffer is comparing always the first sg list entry instead of the prior one. Fixes: 3c4d7559159b ("tls: kernel TLS support") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Dave Watson <davejwatson@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/sock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 9e8f65585b81..bc2d7a37297f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2277,9 +2277,9 @@ int sk_alloc_sg(struct sock *sk, int len, struct scatterlist *sg,
2277 pfrag->offset += use; 2277 pfrag->offset += use;
2278 2278
2279 sge = sg + sg_curr - 1; 2279 sge = sg + sg_curr - 1;
2280 if (sg_curr > first_coalesce && sg_page(sg) == pfrag->page && 2280 if (sg_curr > first_coalesce && sg_page(sge) == pfrag->page &&
2281 sg->offset + sg->length == orig_offset) { 2281 sge->offset + sge->length == orig_offset) {
2282 sg->length += use; 2282 sge->length += use;
2283 } else { 2283 } else {
2284 sge = sg + sg_curr; 2284 sge = sg + sg_curr;
2285 sg_unmark_end(sge); 2285 sg_unmark_end(sge);