🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Martin Schiller Mon, 30 Nov 2026 09:00
[PATCH net v2] net: lapb: fix uninitialized stack frame fields in lapb_decode()
#24518
Author: Martin Schiller
Date: Mon, 30 Nov 2026 09:00
58 lines
12089 bytes
From: Hui Peng <benquike@gmail.com>

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 <benquike@gmail.com>
[ms: keep only the initialization, rewrite the commit message]
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
---
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 <ms@dev.tdt.de>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads