From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64FE5314A9B; Wed, 3 Dec 2025 15:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776600; cv=none; b=XyL7d/3kqhFoo/xXg9DAYy4Pqx5cQZUcNXHaSQVkNP6dPX0uKSepuWMp4YQRN4vDGxo2uZFWNZqGxoyzGy3p3Fd53UDt3HpbNwtUyNLZkYrqNQmMvARIRN0G8YrCe+KIFT25lnotYc58U+BNypGpCSHInm/+39QL5WoSGWW1oqA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776600; c=relaxed/simple; bh=NOS5BwbuOiI63g5t03DD/4hAJIZbmu0hCEJFCwUI49Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aZd1IF7b8gZ3J01r1O10hkF5jQPmWzDHib9gAkVnoBIe4clBfQRLulgvA4enpkq6Ue05Bp/6NJjFuGIrTL+0x+KZjduPK6uHfgVgYBaSwT9SNN3VEcRLgCtKpVKKzS3kNSplMdirLeihjzUI+tcB3bmrgPaUJ0kcuO6ab/KtoKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a235EXFf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="a235EXFf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC2EC4CEF5; Wed, 3 Dec 2025 15:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764776600; bh=NOS5BwbuOiI63g5t03DD/4hAJIZbmu0hCEJFCwUI49Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a235EXFfvgNCvDScLAtlRuxfueKvmY40GncUcAjnC4YC5rkbW2QLyI518FzpL91Gp kCffub21Y0D8heJmCvnXMfTsV6jtP6H1tcNLd4ewlxJ3DK/MLauZwk/9wZbvS7LyVn 0GNitd9BahAAAYOv3LVnQXXG6QyBXVB/1hpdqQOY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shahar Shitrit , Sabrina Dubroca , Tariq Toukan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 231/300] net: tls: Cancel RX async resync request on rcd_delta overflow Date: Wed, 3 Dec 2025 16:27:15 +0100 Message-ID: <20251203152409.184212657@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152400.447697997@linuxfoundation.org> References: <20251203152400.447697997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shahar Shitrit [ Upstream commit c15d5c62ab313c19121f10e25d4fec852bd1c40c ] When a netdev issues a RX async resync request for a TLS connection, the TLS module handles it by logging record headers and attempting to match them to the tcp_sn provided by the device. If a match is found, the TLS module approves the tcp_sn for resynchronization. While waiting for a device response, the TLS module also increments rcd_delta each time a new TLS record is received, tracking the distance from the original resync request. However, if the device response is delayed or fails (e.g due to unstable connection and device getting out of tracking, hardware errors, resource exhaustion etc.), the TLS module keeps logging and incrementing, which can lead to a WARN() when rcd_delta exceeds the threshold. To address this, introduce tls_offload_rx_resync_async_request_cancel() to explicitly cancel resync requests when a device response failure is detected. Call this helper also as a final safeguard when rcd_delta crosses its threshold, as reaching this point implies that earlier cancellation did not occur. Signed-off-by: Shahar Shitrit Reviewed-by: Sabrina Dubroca Signed-off-by: Tariq Toukan Link: https://patch.msgid.link/1761508983-937977-3-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- include/net/tls.h | 6 ++++++ net/tls/tls_device.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/net/tls.h b/include/net/tls.h index c76a827a678ae..b4040f76b007f 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -674,6 +674,12 @@ tls_offload_rx_resync_async_request_end(struct sock *sk, __be32 seq) ((u64)ntohl(seq) << 32) | RESYNC_REQ); } +static inline void +tls_offload_rx_resync_async_request_cancel(struct tls_offload_resync_async *resync_async) +{ + atomic64_set(&resync_async->req, 0); +} + static inline void tls_offload_rx_resync_set_type(struct sock *sk, enum tls_offload_sync_type type) { diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index 5cb6846544cc7..8e89ff403073b 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -710,8 +710,10 @@ tls_device_rx_resync_async(struct tls_offload_resync_async *resync_async, /* shouldn't get to wraparound: * too long in async stage, something bad happened */ - if (WARN_ON_ONCE(resync_async->rcd_delta == USHRT_MAX)) + if (WARN_ON_ONCE(resync_async->rcd_delta == USHRT_MAX)) { + tls_offload_rx_resync_async_request_cancel(resync_async); return false; + } /* asynchronous stage: log all headers seq such that * req_seq <= seq <= end_seq, and wait for real resync request -- 2.51.0