From: netdev-bot+sashiko@kernel.org
To: kyuwoncho18@gmail.com
Cc: jmaloy@redhat.com, tung.quang.nguyen@est.tech,
ying.xue@windriver.com, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, willemb@google.com,
horms@kernel.org, netdev@vger.kernel.org,
tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] tipc: drop discovery messages shorter than the fields they carry
Date: Wed, 25 Nov 2026 08:21:17 +0000 [thread overview]
Message-ID: <179559487720.3135.14203110625179342726@kernel.org> (raw)
In-Reply-To: <179550610427.774194.2378040347436778640@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new check in tipc_disc_rcv() (`msg_hdr_sz(hdr) <
MAX_H_SIZE`) silently drops every LINK_CONFIG message with a header…
- [Low] In net/tipc/discover.c, tipc_disc_rcv() still reads words 13 and
14 of the header before the new length check runs.
--
tipc: drop discovery messages shorter than the fields they carry
This adds a length check to tipc_disc_rcv() in net/tipc/discover.c. It
drops LINK_CONFIG messages whose declared header is shorter than
MAX_H_SIZE, and also those whose data is shorter than NODE_ID_LEN when
TIPC_NODE_ID128 is set. The aim is to stop the media address, words 13
and 14, and the node identity being read from beyond the end of the
message.
> diff --git a/net/tipc/discover.c b/net/tipc/discover.c
> index b9d06595b0673..0f99e4af1cfa9 100644
> --- a/net/tipc/discover.c
> +++ b/net/tipc/discover.c
> @@ -219,6 +219,12 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *skb,
> }
> hdr = buf_msg(skb);
>
> + if (msg_hdr_sz(hdr) < MAX_H_SIZE ||
> + ((caps & TIPC_NODE_ID128) && msg_data_sz(hdr) < NODE_ID_LEN)) {
> + kfree_skb(skb);
> + return;
> + }
[Severity: Medium]
Will this also drop discovery messages from older peers that send a
40-byte INT_H_SIZE header?
Before commit 948fa2d115c5 ("tipc: increase size of tipc discovery
messages"), tipc_disc_init_msg() built discovery messages with an
INT_H_SIZE header. That commit's message says 40 bytes "was enough for
Ethernet/IB/IPv4".
tipc_msg_validate() accepts any hsz from MIN_H_SIZE to MAX_H_SIZE, so
these messages still reach tipc_disc_rcv() via tipc_rcv():
if (unlikely(usr == LINK_CONFIG))
return tipc_disc_rcv(net, skb, b);
The Ethernet and InfiniBand decoders only read bytes inside a 40-byte
header:
- tipc_eth_msg2addr() reads header bytes 24 to 29.
- tipc_ib_msg2addr() reads 20 bytes starting at byte 20, so it stops
at byte 40.
The receiver also still handles peers without TIPC_NODE_ID128:
else
sprintf(peer_id, "%x", src);
Before this patch, discovery with these peers over Ethernet or IB could
still complete, although words 13 and 14 held garbage. After it, the
messages are freed without the "Rcv corrupt discovery message" warning,
and neighbour discovery with those peers stops.
Is dropping interop with these peers intended? If so, could the commit
message say so? The Fixes: tag points at the initial merge, so this
change would go to every stable tree.
Or could the minimum length depend on what each media and the words
13/14 consumers actually need, so that 40-byte Ethernet/IB discovery
keeps working?
[Severity: Low]
This isn't a bug, but words 13 and 14 are still read before this new
check runs. At the top of tipc_disc_rcv():
struct tipc_msg *hdr = buf_msg(skb);
u32 pnet_hash = msg_peer_net_hash(hdr);
u16 caps = msg_node_capabilities(hdr);
bool legacy = tn->legacy_addr_format;
u32 sugg = msg_sugg_node_addr(hdr);
msg_peer_net_hash() returns msg_word(m, 13), and msg_sugg_node_addr()
returns msg_word(m, 14). Both run before skb_linearize() and before the
msg_hdr_sz(hdr) < MAX_H_SIZE test. With a 24-byte header, both words
are still loaded from past the validated header.
The short message is dropped before pnet_hash reaches
tipc_node_check_dest() or sugg reaches tipc_disc_addr_trial_msg(), so
those values are never used.
Could these two reads, or the check, be reordered so the check comes
first? That would match the commit message, which says these fields
"are then read from past the end of the message".
>
> if (caps & TIPC_NODE_ID128)
> memcpy(peer_id, msg_node_id(hdr), NODE_ID_LEN);
> else
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179550610427.774194.2378040347436778640%40gmail.com
prev parent reply other threads:[~2026-11-25 8:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 7:52 [PATCH net] tipc: drop discovery messages shorter than the fields they carry Kyuwon Cho
2026-11-25 8:21 ` netdev-bot+sashiko [this message]
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=179559487720.3135.14203110625179342726@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=kyuwoncho18@gmail.com \
--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 \
--cc=willemb@google.com \
--cc=ying.xue@windriver.com \
/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