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=1796384224; b=Ro0pfXBuZ4iR/mUkgkAxZ84/GwGj8fX3F6/glD7W7KnAYo1pTgbWN3Jm74f2Pq3J+kIF o71XMg19CoZHl7QOrPr01ld3f2XiHvageZZfFrIzMHbNNzFo2/kxE46nfPseqG08WoZGo IM7UW5DeeRNOCoVzgkCfuaqWS8alG/WnaNHfNXRH+X+8BaiyfBPwlSp6OL2ti6UBaVmIr Skj2GgY/GJrf9+9AjzqH53maEY4YVFQc6I0wATcgMeOuuKPXG+HvYccH6KjT3SYwjIshw iqtwkZ8xS8eCOwe86WEltV+mmjvXEN99/+VUXsz/5IykfrLa/Rcnh1L05kKPwJrxLiw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384224; 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=p4HdYztcLSs4EgO4OWRQeo4K16ifJR9yhqnNVWie4yQ=; b=enFSzGH2RT7xc2ukR3hGPVByfQgGA/SwMXoK/Q7d1VZ8fZz4l371G5PFTRfwMom4BOb5 nn/6CsxkxDfQqmspBc6ViZJNZSFnbU3kh6D9+ZWYvPzJ/CNLzUno7iEuff06FoyEFXK4m 8QFSkGIUdL7cnGsp83bpro1mkquGFV2JPfLsfeK407zTpJ53Hh68TqGxKpaxHthmIzHXa 7dryJPhSCpr2YA+RZwoba65O4WlGhD72XbCG2rlA/L40/Ve6wH2OwQsFIgpJmwarutBXL m7qHaeatDCkQZzZklEd+DlGScFlZW/HgL31DerLRYpOdidOUebKVPLEjUv6ZM8MQDeQ== 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=oEeBWP1a; 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 241B8606A322; Fri, 4 Dec 2026 11:37:04 +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=oEeBWP1a Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FBFC1F000C2; Fri, 4 Dec 2026 11:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384224; bh=p4HdYztcLSs4EgO4OWRQeo4K16ifJR9yhqnNVWie4yQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oEeBWP1av+a7fiZoMhF7NubBvMS3nQmBY6NhCNfQRyFeLjsLjgScalk7nk5dPSo2c 3rUnPVGS6jKpaD2BxTWZ5cd96xjJMYgnOfLxsixp6cXgKbgV+CV9uRxgwMyLODjnM7 oZw5ZqsLCR991gPZNsBW/3apFxvKdcwFGYnMXWik= 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 508/555] mkiss: leave the escaped state on any byte after FESC Date: Fri, 4 Dec 2026 19:09:11 +0900 Message-ID: <20261204100628.220285151@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: 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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bernard Pidoux kiss_unesc() sets AXF_ESCAPE on FESC and clears it only on TFEND, TFESC or FEND. When FESC is followed by any other byte, that byte is stored and the escaped state stays set. The next TFEND (0xDC) or TFESC (0xDD) byte of plain data in the same frame is then taken as escaped and stored as FEND (0xC0) or FESC (0xDB): the frame is delivered with a wrong byte. KISS gives no meaning to FESC followed by another byte, and asks that frame assembly goes on. Keep the byte as before, but clear the escaped state, so that the error stays on that one byte. Tested on a QEMU guest (6.12.94, KASAN, lockdep): KISS frames are written on the master side of a pseudo-terminal whose other side has the mkiss line discipline, and an AF_PACKET socket on ax0 shows what mkiss delivers. "A" FESC TFEND "B" before: 41 C0 42 after: 41 C0 42 "x" FESC "Q" "y" 0xDC "z" before: 78 51 79 C0 7A after: 78 51 79 DC 7A "x" FESC "Q" "y" 0xDD "z" before: 78 51 79 DB 7A after: 78 51 79 DD 7A Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Bernard Pidoux Assisted-by: Claude:claude-opus-5-5 (cherry picked from commit 74f8e79c2feb4d6df0f7b036d1620416c289bf1a) Signed-off-by: Sasha Levin --- drivers/net/hamradio/mkiss.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 8b0e2ca5d0ea3..d25ce56102bd5 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -325,6 +325,14 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s) if (test_and_clear_bit(AXF_ESCAPE, &ax->flags)) s = END; break; + default: + /* + * FESC must be followed by TFEND or TFESC. Keep the byte, + * but leave the escaped state so that a later TFEND or + * TFESC data byte is not taken as escaped. + */ + clear_bit(AXF_ESCAPE, &ax->flags); + break; } spin_lock_bh(&ax->buflock); -- 2.53.0