Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2203052iof; Tue, 7 Jun 2022 23:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa5toi7U3SUAzj9YzvgZ+b4qeiC1xu4RaCFrzAcNqURO5DcZSQGpHAxPrL9k7/NzcDBt0t X-Received: by 2002:a05:6a00:1a56:b0:51b:f1af:c2e8 with SMTP id h22-20020a056a001a5600b0051bf1afc2e8mr22053143pfv.48.1654668367083; Tue, 07 Jun 2022 23:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668367; cv=none; d=google.com; s=arc-20160816; b=LAL/21KAjq5hGx3OXrU8h9GtOuGTVQu2UVPp6FoiNwLyWw0xU7LGi76CnRGUq0W2wt ZyVNB/IKkMns5HnwWkcEbmXttpXPgw/eIJrTAtzEGkQedgHBto75C4eBl3nQQf3hwTwV 8pWm3gXzEflYGjv+7x/VNPD92wHDdQRRNP4yX2xBYmcTAg2JjWvMUTyUT9mivKjOAXV0 j1KEhruEydh+U4ylI0t3jcxDz0hdhGeiqsW6RB2m0t9IuTs89GNbApm4bwQOuITp3Vr8 AazDn8Em5D0kFlAa/XzAKjc/C3Wq9221LtL+EIDjsO9Xho3M5n9FZNf2dIjPa9VbFfnL 8Q1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r+Yk5Z0fgt1A6Dx5hkph4MiygaemLENhVrTKwTtwOEA=; b=JrQBHrbiQZTWibJx2NPBasCwzwgUl8OJYiSowMFJTMD+6xKjBafjFUTpddFBX043TC 5wI8/o0nJACbF/sBzU/er8fWxr8IRcHLMA9d5jR9ALmG2c3w1MamJi3e1dOqtfPqL5LE HMdKVdnzuQCudHEMQG470aGUPV2o3h8zFyThwGn//1MJLtfrNKsaPfj51YK0Z55lrMx4 /scui+KOK+6fODwi+VAuKe/aWb4QV4JOKqxJ61SSl9cIjBQOuM6TMCYdrZTngVBi8d/N UPJWC9Nv8NdJO8RfcQ7zgwVAwyrWmyXM7JbBZVfF6p3vYZtbXcembzm+Skw1DQi2Cd18 LemA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qno4Tf19; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o17-20020a170902e29100b0016375294933si23548319plc.4.2022.06.07.23.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qno4Tf19; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 67A852BA0B0; Tue, 7 Jun 2022 22:29:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbiFHBXT (ORCPT + 99 others); Tue, 7 Jun 2022 21:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382747AbiFGVvv (ORCPT ); Tue, 7 Jun 2022 17:51:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D5E423D5F9; Tue, 7 Jun 2022 12:09:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F43DB81F6D; Tue, 7 Jun 2022 19:09:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80EFDC385A5; Tue, 7 Jun 2022 19:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628961; bh=yUWi9eLXk1J9vjjkZvhBAvrAmSPuFeslmO2wWxRBOq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qno4Tf19kIUGpy8a69SHWgkMmKd8VMQc+TyccwQmVVqCEp/GlJH6brqmxOFUxHQF4 CE717dsumKUvYgoB28Gbu88CQAtKDg16eef+3h3e42DQYwnleRHP6CeYHGV65ZsIlx BzVaoyfO9ctiADqsO/WKe8ZktdTSvWdRREyKb1nI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Jeffrey Altman , Marc Dionne , linux-afs@lists.infradead.org, "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 519/879] rxrpc: Fix overlapping ACK accounting Date: Tue, 7 Jun 2022 19:00:37 +0200 Message-Id: <20220607165017.940371166@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells [ Upstream commit 8940ba3cfe4841928777fd45eaa92051522c7f0c ] Fix accidental overlapping of Rx-phase ACK accounting with Tx-phase ACK accounting through variables shared between the two. call->acks_* members refer to ACKs received in the Tx phase and call->ackr_* members to ACKs sent/to be sent during the Rx phase. Fixes: 1a2391c30c0b ("rxrpc: Fix detection of out of order acks") Signed-off-by: David Howells cc: Jeffrey Altman cc: Marc Dionne cc: linux-afs@lists.infradead.org Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rxrpc/ar-internal.h | 7 ++++--- net/rxrpc/input.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index 422558d50571..cc1fe6d00eca 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h @@ -676,10 +676,9 @@ struct rxrpc_call { spinlock_t input_lock; /* Lock for packet input to this call */ - /* receive-phase ACK management */ + /* Receive-phase ACK management (ACKs we send). */ u8 ackr_reason; /* reason to ACK */ rxrpc_serial_t ackr_serial; /* serial of packet being ACK'd */ - rxrpc_serial_t ackr_first_seq; /* first sequence number received */ rxrpc_seq_t ackr_prev_seq; /* previous sequence number received */ rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */ rxrpc_seq_t ackr_seen; /* Highest packet shown seen */ @@ -692,8 +691,10 @@ struct rxrpc_call { #define RXRPC_CALL_RTT_AVAIL_MASK 0xf #define RXRPC_CALL_RTT_PEND_SHIFT 8 - /* transmission-phase ACK management */ + /* Transmission-phase ACK management (ACKs we've received). */ ktime_t acks_latest_ts; /* Timestamp of latest ACK received */ + rxrpc_seq_t acks_first_seq; /* first sequence number received */ + rxrpc_seq_t acks_prev_seq; /* previous sequence number received */ rxrpc_seq_t acks_lowest_nak; /* Lowest NACK in the buffer (or ==tx_hard_ack) */ rxrpc_seq_t acks_lost_top; /* tx_top at the time lost-ack ping sent */ rxrpc_serial_t acks_lost_ping; /* Serial number of probe ACK */ diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 67d3eba60dc7..3da33b5c13b2 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -812,7 +812,7 @@ static void rxrpc_input_soft_acks(struct rxrpc_call *call, u8 *acks, static bool rxrpc_is_ack_valid(struct rxrpc_call *call, rxrpc_seq_t first_pkt, rxrpc_seq_t prev_pkt) { - rxrpc_seq_t base = READ_ONCE(call->ackr_first_seq); + rxrpc_seq_t base = READ_ONCE(call->acks_first_seq); if (after(first_pkt, base)) return true; /* The window advanced */ @@ -820,7 +820,7 @@ static bool rxrpc_is_ack_valid(struct rxrpc_call *call, if (before(first_pkt, base)) return false; /* firstPacket regressed */ - if (after_eq(prev_pkt, call->ackr_prev_seq)) + if (after_eq(prev_pkt, call->acks_prev_seq)) return true; /* previousPacket hasn't regressed. */ /* Some rx implementations put a serial number in previousPacket. */ @@ -933,8 +933,8 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) /* Discard any out-of-order or duplicate ACKs (outside lock). */ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, - first_soft_ack, call->ackr_first_seq, - prev_pkt, call->ackr_prev_seq); + first_soft_ack, call->acks_first_seq, + prev_pkt, call->acks_prev_seq); return; } @@ -949,14 +949,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) /* Discard any out-of-order or duplicate ACKs (inside lock). */ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, - first_soft_ack, call->ackr_first_seq, - prev_pkt, call->ackr_prev_seq); + first_soft_ack, call->acks_first_seq, + prev_pkt, call->acks_prev_seq); goto out; } call->acks_latest_ts = skb->tstamp; - call->ackr_first_seq = first_soft_ack; - call->ackr_prev_seq = prev_pkt; + call->acks_first_seq = first_soft_ack; + call->acks_prev_seq = prev_pkt; /* Parse rwind and mtu sizes if provided. */ if (buf.info.rxMTU) -- 2.35.1