Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2966435ybk; Mon, 18 May 2020 12:17:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQD+MDK9N58K1HOzJi5yqKy+tUmGa/WlxJHK9qGpOMB4sH09DDGLUGi1x6E0Tiz+oBn8o5 X-Received: by 2002:a50:bf03:: with SMTP id f3mr15511282edk.368.1589829477800; Mon, 18 May 2020 12:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589829477; cv=none; d=google.com; s=arc-20160816; b=an6EaLH2eurwCa4Tll0Zf0n6UxLnFAaFlPgcX+GTf/mcOIKb704U3o6cg43CBenAeL jKGdnxUTxUB7O2Dmp7hr0Z9/Ze8YJ13xOrGc1vx9VNJii2aG1dKdjyMky9kSy9N1UZx9 FHZQkF3tTtZ9SUMiPDJkQdha0ZQC65WJwbzJtYoeZW7Z2esSq/DLHHvXKBcAUYfxFqwo Sq8YQC2z1Kya9mGpEsi3DaPLZGi98Ynja+1O1xD5Rq0E0x+UQgCGWrNVZhx18l7dadfi w4kDDetAmyKUxTcdfFfSzXitimlRy0z9wBmfemVOwx3P9A0PGQY6Il+ZAh4+7Jg/unG3 33Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lQNkhQ6xqXPLLVI8jfE+UjRYnqgY0dcII773MC/Rqdo=; b=Ado6AJ6gK49Bsi0b9Xbo1teesWnPK3DCuV5woCd49YU5pp5HH1dKL9QgpwTVzz/F2L caW41j7bvLkAx9isJpjJDhPVvw06Y8H2MptgTOKBDNSXpe+ra4fVFo7RJkVJJgJ0QPz1 1cCmDbIJeV2uxGNOUavZOuOeQb2ZCeewjCuEC9madBmvjgPICewd/W1taFbxOXiMOM1M Y+CDqlKRQ9fJK9zVYvqKUsOk9+htpMmMrFpR8ca0e7Qu/o+iSk/BEmwmrUdNYDOvI+It 8eKH8dh7EU37TMsE/M6rpzFDiqUTeYg7dx2JZNpSiW0/NymFs8L0PY/KmvQZtxVqW58j IylA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0BxU02qp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si5909709edy.554.2020.05.18.12.17.34; Mon, 18 May 2020 12:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0BxU02qp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730800AbgERRvC (ORCPT + 99 others); Mon, 18 May 2020 13:51:02 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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))