Received: by 10.223.185.116 with SMTP id b49csp5449817wrg; Wed, 7 Mar 2018 11:59:18 -0800 (PST) X-Google-Smtp-Source: AG47ELv0Qh6gGiWrmjYcqdA2YtQnZN/t/GX64009/XnPUy5eyDhCwgNVPp1zMibkPVF513bpYtNN X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr21677668plg.41.1520452757947; Wed, 07 Mar 2018 11:59:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520452757; cv=none; d=google.com; s=arc-20160816; b=0fdEm57pv6RRZjS/k4k0E+EdeROFOhFhWHWdJia4Xn+RGtdb44HGJGu6lUAHRtuFs6 hZnbIBZ0NINCj+oXGUmAq/7fNxThU4agZl8jkGaFQ1W1OhUH3pbkhYhNwGLb10rXqykT 9pOnjX5hb6okCLcKyNdmjSvh3TCepzK4biM/psVVdP6BSeNOSUAWj+dLds4VXNdSyfBM e+oUwXH4Qsls7B0eO2o724fPyIvm5toEbZCUH1kRU0McJOPohI5uYpkWXFU0//mlOu3e 49GD+bBegoK502ZXoHFIkHOw+wfk03Ig9CkbouZp4Ut3VYm99OyiHZiDdWyKHKMuOM9B Kq1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4TXJ72C4INth/PqKa9HvPWb10Fam4Sbn8FOo5COKlhM=; b=ypNNZsVsSxdVM/zawNg3dfyQO/gU9BBNCcxsw6ToHgc0XFo/HaPVwlNkbu3fsu1dQr HIdZqWrtjtNrXy4JkH5R3kbGNdVm+d/+s0ylUf5OzRSD6GuZi5jY6zBWkiEahyKFcV1g /m9QNkkTGvZBFn4WITPVhXp/q34hweYdy9UCoQfknvQmbTmtz59cu+TC9Tkm/df7hji2 8Gp16TjCz9AWyjaev7Wy4TV8vx3brR1sh6wzFechaFXq1OeybajTCXho+8oUs2ypIZ28 tKCDOPL9p8klMzAvL/RYKUQ9Wb/172c3Yxg3O6Zryfsl7yhpu48YgwrWq395bdceqb5k VIvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az8-v6si4745379plb.485.2018.03.07.11.59.03; Wed, 07 Mar 2018 11:59:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965695AbeCGTrM (ORCPT + 99 others); Wed, 7 Mar 2018 14:47:12 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44882 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754916AbeCGTrI (ORCPT ); Wed, 7 Mar 2018 14:47:08 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 43578F6E; Wed, 7 Mar 2018 19:47:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Lesokhin , "David S. Miller" Subject: [PATCH 4.14 052/110] tcp: Honor the eor bit in tcp_mtu_probe Date: Wed, 7 Mar 2018 11:38:35 -0800 Message-Id: <20180307191046.344937554@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilya Lesokhin [ Upstream commit 808cf9e38cd7923036a99f459ccc8cf2955e47af ] Avoid SKB coalescing if eor bit is set in one of the relevant SKBs. Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg") Signed-off-by: Ilya Lesokhin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_output.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1973,6 +1973,24 @@ static inline void tcp_mtu_check_reprobe } } +static bool tcp_can_coalesce_send_queue_head(struct sock *sk, int len) +{ + struct sk_buff *skb, *next; + + skb = tcp_send_head(sk); + tcp_for_write_queue_from_safe(skb, next, sk) { + if (len <= skb->len) + break; + + if (unlikely(TCP_SKB_CB(skb)->eor)) + return false; + + len -= skb->len; + } + + return true; +} + /* Create a new MTU probe if we are ready. * MTU probe is regularly attempting to increase the path MTU by * deliberately sending larger packets. This discovers routing @@ -2045,6 +2063,9 @@ static int tcp_mtu_probe(struct sock *sk return 0; } + if (!tcp_can_coalesce_send_queue_head(sk, probe_size)) + return -1; + /* We're allowed to probe. Build it now. */ nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); if (!nskb) @@ -2080,6 +2101,10 @@ static int tcp_mtu_probe(struct sock *sk /* We've eaten all the data from this skb. * Throw it away. */ TCP_SKB_CB(nskb)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags; + /* If this is the last SKB we copy and eor is set + * we need to propagate it to the new skb. + */ + TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor; tcp_unlink_write_queue(skb, sk); sk_wmem_free_skb(sk, skb); } else {