Netdev List
 help / color / mirror / Atom feed
* [PATCH net] tipc: reject service-range connection messages sent to a datagram server
@ 2026-12-02  9:45 Tung Nguyen
  2026-12-02  9:48 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Tung Nguyen @ 2026-12-02  9:45 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, edumazet, pabeni, jmaloy, horms, tipc-discussion,
	willemb, Tung Nguyen, Andrew Stellman

For connection-oriented messaging, the address types that can be used are
service addresses or socket addresses on the client side, and service
addresses or service ranges on the server side.

However, the current implementation allows a client to send a SYN or an
implicit connection message using a service range. It also allows a server
socket that is neither SOCK_STREAM nor SOCK_SEQPACKET to receive a SYN or
an implicit connection message. This violates the TIPC protocol
specification.

Fix this by:
- returning -EINVAL when a client uses a service range to establish a
connection.
- sending a reject message (TIPC_ERR_NO_PORT) when the server socket
is neither SOCK_STREAM nor SOCK_SEQPACKET.

Fixes: b97bf3fd8f6a ("[TIPC] Initial merge")
Reported-by: Andrew Stellman <astellman@stellman-greene.com>
Closes: https://lore.kernel.org/netdev/20261129001748.78733-1-bugs@stellman-greene.com/
Signed-off-by: Tung Nguyen <tung.quang.nguyen@est.tech>
---
 net/tipc/socket.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index c607563bb35a..1366c6a49d79 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1458,6 +1458,8 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
 			return -EISCONN;
 		if (tsk->published)
 			return -EOPNOTSUPP;
+		if (atype == TIPC_SERVICE_RANGE)
+			return -EINVAL;
 		if (atype == TIPC_SERVICE_ADDR)
 			tsk->conn_addrtype = atype;
 		msg_set_syn(hdr, 1);
@@ -2377,6 +2379,7 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb,
 		hdr = buf_msg(skb);
 		limit = rcvbuf_limit(sk, skb);
 		if ((sk_conn && !tipc_sk_filter_connect(tsk, skb, xmitq)) ||
+		    (!sk_conn && msg_is_syn(hdr) && mtyp != TIPC_MCAST_MSG) ||
 		    (!sk_conn && msg_connected(hdr)) ||
 		    (!grp && msg_in_group(hdr)))
 			err = TIPC_ERR_NO_PORT;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  9:45 [PATCH net] tipc: reject service-range connection messages sent to a datagram server Tung Nguyen
2026-12-02  9:48 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox