From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6680C433E0 for ; Mon, 18 May 2020 18:22:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E27520657 for ; Mon, 18 May 2020 18:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589826123; bh=5QqJiQ40v8Ooe7yKSlu2SDUc4FBYOAphE52G5rzRf/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uwgDTY5xZnKC4UsWTf5hUzP6BBSLmIueIlw0mXcvTsY8YgZhaJDiGPBdkTPRtHbXs ykaA+Vd7JI+YFlhXuNgKLrsA5ZqCZXpvQV82RiRr6pVxkJf5KxvAToi4O8gfKIOXVt 740HOlEUDFv1WW26A76lK8KbGj4EIJe/z4f4yGfM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730795AbgERRvB (ORCPT ); Mon, 18 May 2020 13:51:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730750AbgERRvA (ORCPT ); Mon, 18 May 2020 13:51:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 79AAD20674; Mon, 18 May 2020 17:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589824259; bh=5QqJiQ40v8Ooe7yKSlu2SDUc4FBYOAphE52G5rzRf/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BxU02qp07qKaeyVXDEK6UchxZhKqM94vPi1Zt1rbyHbZoW6H+JdCYVjIxl0TWEPw FnZeQBJnPxlIVjTlzrsx21qGK7KTEQkO9y4isOGaJfNOo+F2OkefNdrN6upYkZY4LE tytq1qFagrRkqYOj7kExQMDHvaMUhrAIWbp41Oso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Iris Liu , Kelly Littlepage , Eric Dumazet , Soheil Hassas Yeganeh , Willem de Bruijn , Jakub Kicinski Subject: [PATCH 4.19 20/80] net: tcp: fix rx timestamp behavior for tcp_recvmsg Date: Mon, 18 May 2020 19:36:38 +0200 Message-Id: <20200518173454.450998092@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173450.097837707@linuxfoundation.org> References: <20200518173450.097837707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kelly Littlepage [ Upstream commit cc4de047b33be247f9c8150d3e496743a49642b8 ] The stated intent of the original commit is to is to "return the timestamp corresponding to the highest sequence number data returned." The current implementation returns the timestamp for the last byte of the last fully read skb, which is not necessarily the last byte in the recv buffer. This patch converts behavior to the original definition, and to the behavior of the previous draft versions of commit 98aaa913b4ed ("tcp: Extend SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg") which also match this behavior. Fixes: 98aaa913b4ed ("tcp: Extend SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg") Co-developed-by: Iris Liu Signed-off-by: Iris Liu Signed-off-by: Kelly Littlepage Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Acked-by: Willem de Bruijn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2135,14 +2135,16 @@ skip_copy: tp->urg_data = 0; tcp_fast_path_check(sk); } - if (used + offset < skb->len) - continue; if (TCP_SKB_CB(skb)->has_rxtstamp) { tcp_update_recv_tstamps(skb, &tss); has_tss = true; has_cmsg = true; } + + if (used + offset < skb->len) + continue; + if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) goto found_fin_ok; if (!(flags & MSG_PEEK))