From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382792; b=FbXb2QQ3pydRQ289RugqutNcqOeEQ1RfCNw4jz5PUX0OacxLjrEr2NZVj+GZz13mKOqN X5WqJznMqbihcXQ36YL3GTeo5+w+g4qJCekEB8foWaJepIFt+yViGY60A7+rTfuxI3YsS Xmpu8QVVMZrWNLMM1C8dIKJC9+Z9ndGcUB+QaQkJECcEi+AKQyLY/YYQyuNW/Nyfawzut uasMNS6uQuZbqauVKCcbflNQ3RbwHP4GcYDAitac+hgVv0+n3wAmL3mlA6XZHa8rIrBp+ +jwwm1TxyY2gzYtqPKepfYRhcMWGuz95/H3S/FiRBv+2J09DqOcgj2OQ5b77EH2bIGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382792; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=5JTcuo+BqiKPZeLCVw/xru52FFVdCrlt/j65BhiZgHo=; b=dIHejCNwgKu508axkqM9udHv7OLginzlT3IiAqTw86DCtWspmJRZm3/1YcCSFskQFkIH 3x2LTudPqXBTdacgEmtyUZfDPGD5MAYaQ8+43cGgc2MLGZE92UJ9QjTk72o7njY6gmP0a griqeXPq5NAWDSz4j86z1a+dfraKRi9QfaIysUeczeNqBhbGnaqrbcviEU2DyIOHn+Cet YCmx66o1S7di7QU/FkQh3B56X+Kgvp2lEmjQHNwJu5rhMsnbM81leZG+0hrPhRw7yPTAM YY7RTR2DXJMW6UG+s1kj2K3+MZEFGdW3UaObjB/W/Z2bVIpl3NMPpaclJYSmYVnpPjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=jyAJhvpE; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9641606A333; Fri, 4 Dec 2026 11:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=jyAJhvpE Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECBA41F000C2; Fri, 4 Dec 2026 11:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382792; bh=5JTcuo+BqiKPZeLCVw/xru52FFVdCrlt/j65BhiZgHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jyAJhvpEq1J+LsvTmIkjhvRuBh9KtGa9qVo04i8720y8Zg5b71kngZHJQYZjvFYuD mz1MYuKEk7bRL4ROHbXo+2k66v+ISN5Le1lgYM3Y1QEr2alpsSlap2p6M2F41GsFOn pZvXY5Idq0wCF6tG6HaDgq6O0ZQ3dOyZyw7U3rms= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bernard Pidoux , Sasha Levin Subject: [PATCH 6.18 602/703] rose: acknowledge delivered data before resetting a call Date: Fri, 4 Dec 2026 19:08:21 +0900 Message-ID: <20261204100643.793576101@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bernard Pidoux When a DATA packet arrives in sequence but cannot be queued, because the receive buffer is full or a socket filter drops it, the call is reset ("Should never happen"). Acknowledgements are held back for up to the hold-back time (5 s by default), so the peer has usually not been told yet about the packets the application already received. On the reset, rose_requeue_frames() makes the peer send all its unacknowledged packets again, and these packets are delivered a second time: the application gets the same data twice. The receive buffer fills easily: OWN_RX_BUSY is only set after a packet has been queued, and the RNR that tells the peer to stop waits for the next acknowledgment. Send RR (or RNR) with the current V(R) before the reset, as is already done when a packet arrives out of sequence, so that the peer only sends again what was not delivered. Tested on two QEMU guests (6.12.94, KASAN, lockdep) linked by KISS: A calls B and writes twelve messages of 200 bytes; B has a minimal receive buffer and starts reading after 20 s. before: B reads 15 messages, three of them twice (a, b, c) after: B reads the 12 messages once each, in order No KASAN, lockdep or WARN report. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Bernard Pidoux Assisted-by: Claude:claude-opus-5-5 (cherry picked from commit f0917462b6fe270717add07f8c173ac3f330481a) Signed-off-by: Sasha Levin --- net/rose/rose_in.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c index b58f3b2700a69..0154b16e0cfd2 100644 --- a/net/rose/rose_in.c +++ b/net/rose/rose_in.c @@ -179,7 +179,14 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety rose->vr = (rose->vr + 1) % ROSE_MODULUS; queued = 1; } else { - /* Should never happen ! */ + /* + * The receive buffer is full (or a filter + * dropped the packet). Acknowledge first what + * the application already has: the reset makes + * the peer send its unacknowledged packets + * again, and those would be delivered twice. + */ + rose_enquiry_response(sk); rose_write_internal(sk, ROSE_RESET_REQUEST); rose->condition = 0x00; rose->vs = 0; -- 2.53.0