From: Andrew Stellman <bugs@stellman-greene.com>
To: Jon Maloy <jmaloy@redhat.com>,
Tung Quang Nguyen <tung.quang.nguyen@est.tech>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: [PATCH net] tipc: reject bundles too short for an inner header
Date: Sat, 28 Nov 2026 09:08:30 -0500 [thread overview]
Message-ID: <20261128140830.58925-1-bugs@stellman-greene.com> (raw)
From: Andrew Stellman <astellman@stellman-greene.com>
tipc_msg_extract() checks *pos against msg_data_sz(hdr) - MIN_H_SIZE.
msg_data_sz() is unsigned, so for a header-only MSG_BUNDLER, which
tipc_msg_validate() accepts, the subtraction wraps and the check
passes. The following msg_size(ihdr) then reads four bytes past the
end of the bundle. Check that the data can hold an inner header
before subtracting.
Tested on mainline (7cd8495c0f16) in arm64 QEMU with KASAN. A test-only
debugfs hook, not part of this patch, built a header-only bundle in the
kernel, passed it to tipc_msg_validate() and tipc_msg_extract(), and
poisoned 8 bytes of tailroom after it as a redzone so KASAN would flag
the read. No live TIPC link was used, and the bundle didn't come from a
peer. Without this patch KASAN reported a 4 byte read in
tipc_msg_extract() in both of two runs; with it, none in one run. A
bundle holding one valid 24 byte message was extracted the same way in
all three runs. No selftests were run.
Fixes: ef9be755697f ("tipc: eliminate buffer cloning in function tipc_msg_extract()")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
Claude Opus 5.5, and both were reviewed by me.
A reproducer is available on request.
net/tipc/msg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 39dfd33c8eecc8..657c0709a0f7a1 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -600,7 +600,8 @@ bool tipc_msg_extract(struct sk_buff *skb, struct sk_buff **iskb, int *pos)
goto none;
hdr = buf_msg(skb);
- if (unlikely(*pos > (msg_data_sz(hdr) - MIN_H_SIZE)))
+ if (unlikely(msg_data_sz(hdr) < MIN_H_SIZE ||
+ *pos > (msg_data_sz(hdr) - MIN_H_SIZE)))
goto none;
ihdr = (struct tipc_msg *)(msg_data(hdr) + *pos);
reply other threads:[~2026-11-28 14:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261128140830.58925-1-bugs@stellman-greene.com \
--to=bugs@stellman-greene.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tung.quang.nguyen@est.tech \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox