tipc_disc_rcv() reads the media address and words 13 and 14 of a full MAX_H_SIZE header, and the 128-bit node identity from the data after it, but tipc_msg_validate() only checks that the declared header is at least MIN_H_SIZE. A peer on the bearer can send a discovery message with a 24-byte header, and those fields are then read from past the end of the message. For a UDP bearer, tipc_udp_msg2addr() takes the peer's address from there: BUG: KMSAN: uninit-value in tipc_udp_msg2addr (net/tipc/udp_media.c:129) tipc_udp_msg2addr (net/tipc/udp_media.c:129 net/tipc/udp_media.c:159) tipc_disc_rcv (net/tipc/discover.c:227) tipc_rcv (net/tipc/node.c:2136) tipc_udp_recv (net/tipc/udp_media.c:389) udp_queue_rcv_one_skb (net/ipv4/udp.c:2433) udp_queue_rcv_skb (net/ipv4/udp.c:2473) Uninit was created at: kmem_cache_alloc_node_noprof (mm/slub.c:5105) __alloc_skb (net/core/skbuff.c:616 net/core/skbuff.c:716) Discovery messages have been sent with a MAX_H_SIZE header since commit 948fa2d115c5 ("tipc: increase size of tipc discovery messages"), and with the node identity after it when TIPC_NODE_ID128 is set. Drop the shorter ones. Fixes: b97bf3fd8f6a ("[TIPC] Initial merge") Signed-off-by: Kyuwon Cho --- The issue was found by an LLM-guided test generator that we are developing as a research prototype: as an unprivileged user in its own user and network namespace, it enables a UDP bearer and sends it a discovery message with a 24-byte header. KASAN stays quiet, as the bytes read are in the skb's tailroom; KMSAN reports them as above, and the kernel logs "Rcv corrupt discovery message" for the address built from them. The patch was written with LLM assistance; we reviewed and tested it. With it, the short message is dropped without KMSAN reports, and two namespaces joined by a veth pair with UDP bearers still discover each other and bring the link up. net/tipc/discover.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/tipc/discover.c b/net/tipc/discover.c index b9d06595b067..0f99e4af1cfa 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; + } + if (caps & TIPC_NODE_ID128) memcpy(peer_id, msg_node_id(hdr), NODE_ID_LEN); else -- 2.43.0