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=1796384130; b=maGpfISJ12/YVxbVLfKSpyXbD8PEW5WW1K9XMputn8oOXNYGA3VZoCclc54FzfTZnYrg ldTtwCvxmiFAPFMSvrtwy6MIVd/VDTtk2oGQJxkYtX5ALLb5un8h0R2Ks4wX3HPt/0Rjv LXbo9Bq7i/uI9vUWu0WGWKKdhGVchJ6U/u4swbnPsma8Y8IcApfKSOOY9/HhgD55lRHn7 P/RPxKUARGGbJ+/XQLXqDry1DbsHYPL0Kkm4je9Gs8WBTDntyOrn9XidtHaSv81aE8usk 0cU2qH8ax1Of3zMzC7Z9WRub8HcdjG73whZnWgG6HByslm3Xh07fPvsCpxzpiu1W0Sw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384130; 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=K3PQreI4sBwa6/ymLnp7c/+kuzQvC6ryWsFbhN3KLAM=; b=SPYT3JNMD/C86XgOc/TH/ItKLTSlDQEeFPGP6K8wbYtnrNJtDAKJRc3M3+UoRYqNq2Ye Xrje37xGEZNyEjiq25KH0JVU8hQP7qwAD9OzosYwen2oniq97YztqLJ77KRlnTSzkQIKV G96GEp2WQtB+GqmlcJcxsJ00Nf+BzIlBIDUOlkiMfESZIT8beLd0BQF4+Ip8siLFXDV6G FlhBh5TRgCj/k6ymIkjtr+4X7AHsPLMTvk28pzdmZ/1vdCWMuPUD7h6GbgB0PcZaHAacv RQ2cB4QJa4eNNC8mQyNGhepKlMTq7Vq7k0kf4deYYmx1Y4j0/cuiRADFGeOrx3WLA+Q== 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=K6twvVXt; 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 51343606A322; Fri, 4 Dec 2026 11:35:30 +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=K6twvVXt Received: by smtp.kernel.org (Postfix) with ESMTPSA id C03E31F00897; Fri, 4 Dec 2026 11:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384130; bh=K3PQreI4sBwa6/ymLnp7c/+kuzQvC6ryWsFbhN3KLAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=K6twvVXtFaUKwXti9iih+Tiekn5u1PNMtr2+ogqMTBHwdqHh0hD+a4MRMeZmiP3eD /UPpX33lhTxT2fVc/YwlBb+lXMCDO55fc574aql6nK+3ps2S/DZCDs2x3YVhOKN7hE kawV0sPmiCw3UoL+cF1mm/aNLUbhEKUF5Qtg8DVo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bernard Pidoux , Sasha Levin Subject: [PATCH 6.12 510/555] rose: acknowledge delivered data before resetting a call Date: Fri, 4 Dec 2026 19:09:13 +0900 Message-ID: <20261204100628.272058033@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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 980f82655c12e..0bb801c3142c8 100644 --- a/net/rose/rose_in.c +++ b/net/rose/rose_in.c @@ -178,7 +178,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