From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.198.224.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796029264; b=CegraGY9eVcpmVjNYk5nNIwoQb7pvzp5JjWTDBl/mYY2JBSCDgyrzrKgwh+PtxRKqjvD mCJRj87vUUQLXX4wyLKxuMIwssU9Ge0No+4NnK660ms6BQNJunQo3tWTYNNzhmFsNARHl 8LMB9tWQbAiXZTb2YcpvN+7T7mMoFvzz9bXrBODCDSxs7AYHxTk5Iy2lRiWtVC4Kt8Y9k kXE9yM3/VoxdkL1hUBp6a0jnq0Hyjk3RLLNOp3HMJQJEaUqGbkjaVlZ8aYYOu99WI0J8F UkMhgbxVDpEFusIPyOMgQzdX57jfMUfRpcV/2LuovFDHQTOUBpNUJzzMCZhQmOcavTA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796029264; h=DMARC-Filter:Received:Received:DKIM-Signature:Received:Received: Received:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:X-B4-Tracking:X-Change-ID:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key:X-Spam-Status: X-Spam-Checker-Version:X-purgate-ID:X-purgate-type:X-purgate; bh=OkBBnUiQRvkt5y2oy59NIvAONfAaUR92irGP7oCp9xw=; b=uUGMgzW6iKU+uH0pqSXrf662ViBuHOWC5EdJ3kKU179eU9m6Wk9uS41GMj2PtImotz3A GP5dpTN69Q1UhJPFjdAK2324zNdERBr5z/vHnloIa6cZlqaIQpBdnMjWZAG6kvEtFSIDC MPX/exbIh0dvsKeOQRam9Utj/NHM9df+VOlaeL2yPYld49D0AfymaBSAJwwWEevOnec4c GyeGP0OfL8A11pcRR0DO6BBSnp7eXo+MxfhKwatuyL7urP+BflFGsGid22t1Uq/oP58im 6mnuTaEk9Hm1eX6WVZ8+5zrLe9ZpSMUYZnoWAczR8j6706ihhu1q2pudsf0YLsEoqkA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=dev.tdt.de; spf=pass smtp.mailfrom=dev.tdt.de; dkim=temperror header.d=dev.tdt.de header.i=@dev.tdt.de header.a=rsa-sha256 header.s=z1-selector1 header.b=MgSdMEiK; arc=none smtp.remote-ip=91.198.224.70 Received: from mxout70.expurgate.net (mxout70.expurgate.net [91.198.224.70]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35DFC606A327; Mon, 30 Nov 2026 09:01:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 35DFC606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dev.tdt.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dev.tdt.de Authentication-Results: smtp.subspace.kernel.org; dkim=temperror header.d=dev.tdt.de header.i=@dev.tdt.de header.a=rsa-sha256 header.s=z1-selector1 header.b=MgSdMEiK Received: from [194.37.255.9] (helo=mxout.expurgate.net) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1xXxFl-0080cE-Ab; Mon, 30 Nov 2026 10:00:53 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1xXxFk-009WwN-8E; Mon, 30 Nov 2026 10:00:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev.tdt.de; s=z1-selector1; t=1796029251; bh=OkBBnUiQRvkt5y2oy59NIvAONfAaUR92irGP7oCp9xw=; h=From:Date:Subject:To:Cc:From; b=MgSdMEiKKBy9QVc1ngrNHSLGbRsLGhw6c6auFdhsjcUC2IdgcFhuyhDo0zsAeBuFk P6wf8oD3zj11MhxMCqmw+8Qcqq+n4TxPlvgI1SL57evWQoDhomZdMkzD+LhgjFBSC0 nhXK5H7I2cv1zUhAXNKsPmPQRlPMeapOQoFHeYUPGyLnj8ktm8IOIA3YZAWDKxvttH +qmhFYNCDO03rqEk2uHz15gXsvULHA4VDIy4I0MCx8eABMu/h6GN42b0qzZ5c9vPF2 RQZtAS9oTz420T13fKVGnGEUzDr7OF0dhw/XndHwnyvOisyu6qAKq4/ZPB/GQK5Oz3 nn6EXAcCAVAOg== Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 8F71C240040; Mon, 30 Nov 2026 10:00:51 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 86A75240036; Mon, 30 Nov 2026 10:00:51 +0100 (CET) Received: from [127.0.1.1] (unknown [10.2.3.19]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 38CE92A88C; Mon, 30 Nov 2026 10:00:51 +0100 (CET) From: Martin Schiller Date: Mon, 30 Nov 2026 10:00:43 +0100 (CET) Subject: [PATCH net v2] net: lapb: fix uninitialized stack frame fields in lapb_decode() X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20261130-lapb-decode-v2-1-d441aa763c33@dev.tdt.de> X-B4-Tracking: v=1; b=H4sIADo7DWsC/x3MTQqAIBBA4avIrBP8I6yrRAvLsQZCRSOC6O5Jy 2/x3gMVC2GFkT1Q8KJKKTaojsG6u7ghJ98MSqheSi344fLCPa7JI7e91doIHawZoBW5YKD7v00 Q8YT5fT9FkHEBYgAAAA== X-Change-ID: 20261130-lapb-decode-86833403f849 To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman Cc: Hui Peng , linux-x25@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schiller X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796029251; l=2410; i=ms@dev.tdt.de; s=20260220; h=from:subject:message-id; bh=dqdcuYF+jZyev6G/B/diD1S6kX+XcrhT0AzDjhhjC5Y=; b=Oc3JTV6yM3LzpLUgK7KJfCEa9//kXeJneENQn2f2WAMgA+wAlZNXupnKqVJZAo6mpBR3VEQih jF1CDwG2Td/BDji+vlZJRNObG0iC4Fbuk5d74BVEhiP0YMp12+GlHZI X-Developer-Key: i=ms@dev.tdt.de; a=ed25519; pk=MAojd7D5IafMnqCYSFC7hY/u/jppX58CLIEhsEsSOYE= X-purgate-ID: 151534::1796029253-FFCFF71F-AC96C737/0/0 X-purgate-type: clean X-purgate: clean From: Hui Peng lapb_decode() fills a struct lapb_frame on the stack of lapb_data_input(), but sets frame->cr only if the address byte of the received frame is one of the two values expected for the configured mode. For any other address byte, frame->cr stays uninitialized, and it is used later: lapb_check_need_response() decides from it whether to answer the frame, and lapb_transmit_frmr() sets a bit of an FRMR frame from it. How such a frame is handled therefore depends on leftover stack contents. Zero the frame at the start of lapb_decode(). A frame with an unexpected address byte is then neither a command nor a response, so it is not answered, and an FRMR for it does not mark it as a response. This has not been reproduced at runtime: without KMSAN, the uninitialized value causes no warning, only behaviour that depends on the stack contents. The fix was validated by code inspection. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Hui Peng [ms: keep only the initialization, rewrite the commit message] Signed-off-by: Martin Schiller --- v2 (Martin Schiller): - keep only the initialization; dropping frames with an unexpected address byte changes the protocol behaviour and belongs in net-next - rewrite the commit message: only frame->cr is affected, control[1] is always set in extended mode and never sent in standard mode - drop the Assisted-by line; v1 said an LLM was used, without naming which - v2 was prepared with the help of an AI assistant (Claude, Anthropic) - Link to v1: https://lore.kernel.org/all/20260919213639.3314894-1-benquike@gmail.com/ --- net/lapb/lapb_subr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c index 592a22d86a97d0d591886ecf9d7d81d726ce5eb8..6911e6269d1f58976e3b80c6c817d340e376a2d5 100644 --- a/net/lapb/lapb_subr.c +++ b/net/lapb/lapb_subr.c @@ -106,6 +106,7 @@ int lapb_validate_nr(struct lapb_cb *lapb, unsigned short nr) int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb, struct lapb_frame *frame) { + memset(frame, 0, sizeof(*frame)); frame->type = LAPB_ILLEGAL; lapb_dbg(2, "(%p) S%d RX %3ph\n", lapb->dev, lapb->state, skb->data); --- base-commit: e2fb9368a41662bc54624f9be87ea8989b109306 change-id: 20261130-lapb-decode-86833403f849 Best regards, -- Martin Schiller