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=1796382784; b=xvvkOAyCgSX7capVufLeFp3CqE02diDH8kwbFLGXi594ZTMJFWKf2Ys4TLGuEUw2sUXR t3C10s+/5iHwQBMgDgBy5K3w1yyaRSVAhEZRix1h45A0XCkclatmEtZt9JnO0Yi2ukUYt FBU4I1zC1nYdsDW84ecPqE+yjGp0ApGJsxgcyij9dKyGkAShdrAY6r9LodtZFpvsPOyPd DXf2NL017Siqu+csikpFw0XCaoIt8AlD+WQcCCybZ9xWkveYOqzth3KoJhRklLBziKsKy GNDa2rJ30rZXqKiPBt1+CHUghEYcfa8y2V5FsFqXKPc1urNPibUAJooUUWcLgKgcxpw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382784; 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=6BIakyG9Frm+s2DeiMj3vSch0aFccfy/RDQ8pOpefho=; b=G1X6D6x121abvCJ4RM8GoozfKDo+T7H+JiWYmXWHwuNk7fRwa5hcexaXRFRgxrhZ5FnK YfLozONV581s8MyQo1Rssv3i+rNKRO/yroMBNtV4VNsBjJ/leaUkwuZFNgroE4E09h0cY uPkaM7/ozY4UCsZ/mpDu8cMx3uxQTGSZ+cM/vkoxSzlKu+wWF9EMM5SMKMxVnBYzjxMYf mAU3MxBhzFY/XpqIOtUjdslUe9VQLk5qDzBCqQcbtXmikmLaOPx4YZfUEv4KXVaA8BzHt n8RAgjTpwBAHFMXIV5Kutul39POKXDGfE6lkKe9btGLC7vC5gNUFtw02mUpOFHS80HA== 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=P0wVKes5; 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 71C96606A322; Fri, 4 Dec 2026 11:13: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=P0wVKes5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC3C81F000CE; Fri, 4 Dec 2026 11:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382784; bh=6BIakyG9Frm+s2DeiMj3vSch0aFccfy/RDQ8pOpefho=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P0wVKes57hvax3W8tC+99ohostVUtu50FBPX95zSTj9if2IgJf/lwzl2KE3EkAQff TzrlVrU8VGO+WOjXJvXz83Tt7B/Y5H3qD/VMKC7ELBQ81CKhwyi9IjSbkGK4ugVSWF LpxyAOfimhdugXeE+dqXZZl5ITvwoIS+hCFSuhuo= 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 600/703] mkiss: leave the escaped state on any byte after FESC Date: Fri, 4 Dec 2026 19:08:19 +0900 Message-ID: <20261204100643.721613436@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 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