Received: by 10.223.185.116 with SMTP id b49csp5491365wrg; Wed, 7 Mar 2018 12:42:23 -0800 (PST) X-Google-Smtp-Source: AG47ELv0NcsMG2xmws7TRYO2arFKFlcrt2mTQBWv+EfrGNLMfCXQcjRKvXtpzK3DVwScxQmDgtPD X-Received: by 10.98.10.65 with SMTP id s62mr23754560pfi.234.1520455343660; Wed, 07 Mar 2018 12:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520455343; cv=none; d=google.com; s=arc-20160816; b=z5GGWVwCCYC/giVihraCJ49Nx+rTP13OCxsHhjBDUA/j0qoX5yObTDBoBDDggLeAoS Xz2ofAyu+BokA5uYBTRVy2ZdWCQ8/4dOcSrw2pR5oml2QzxGKln/4pMqP045rYnTNnGy FRT9VGAOWb0kYXeAWSc9LXLdbdbzhDad2J9f3CuEA0YY8SSzOo+NSZY81Vqn8n85aT0N 0BQ6I1yWwAIv7B1r8V9R2wHZ6c6TllgFfELWnYDeMUs43ngRpbhLHcO7AP0pkUk80iGg ir86fG0eK4miLUecdFoi84BLjNgI9BHnUr3lp9zHqdxU1chCJKVNGDXSzKuNeGLCOkRe JWFg== 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=uHrmFz6F2TjvqKN9/2GwCxC9h1iJM7ECVx8HmBoKNCs=; b=EiTD3X0FzM7pNzdwZgv0Ei8wZSLyCIDHLUK2WeSKAGFQHbhvoo5kyNLmqKyHe3MjFa DnvbwWYPvGbiz71Awsy2W2qYAOkkfCgC46G2+FwSfIdnYgyWD8GGZFO01dk/1hYuudso 8Tucdt4ynq5Ij+ie9J3b9AwNIXmsPoVzzKmH5WrT9NemwXn7FLPxEbuVPg1I4m0rg2Dy KYHWbNEavW200PkMpXnLyxv8Vy1UIkWEewdc5j/gAxAe3s7HMJ/WGYw62B4mnrmd6VV7 7e4p/guCbT3QxJYK3l7ShFFh+VjCP2gdK8GrEFUp3WrYabSUZT37gu8S9VKvVmVZefHw w7RQ== 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 u2si10315927pfd.201.2018.03.07.12.42.09; Wed, 07 Mar 2018 12:42:23 -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 S934884AbeCGUk3 (ORCPT + 99 others); Wed, 7 Mar 2018 15:40:29 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41110 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934713AbeCGTle (ORCPT ); Wed, 7 Mar 2018 14:41:34 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C7941FB3; Wed, 7 Mar 2018 19:41:33 +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.15 057/122] tcp: Honor the eor bit in tcp_mtu_probe Date: Wed, 7 Mar 2018 11:37:49 -0800 Message-Id: <20180307191737.450697477@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@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.15-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 @@ -2026,6 +2026,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 @@ -2098,6 +2116,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) @@ -2133,6 +2154,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 {