Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message's reproducer and problem statement don't match
the code.
- [Low] tipc: Fixes trailer cites initial merge instead of 0abd8ff21f19
--
tipc: reject service-range SYN sent from connection-oriented socket
This commit makes __tipc_sendmsg() return -EINVAL when a
connection-oriented socket tries to set up a connection to a
TIPC_SERVICE_RANGE destination. Before this change, such a send fell
through to tipc_sendmcast().
Closes: https://lore.kernel.org/netdev/2026…@stellman-greene.com/
> The issue can be reproduced as follows:
> 1. Run a connection-oriented server that binds to a service range.
> 2. Run a connection-oriented client that binds to a service range, then sends an
> implicit connection message to the server using sendto().
> 3. Read from the server socket. The server still receives the connection
> message, which is unexpected behavior.
[Severity: Low]
Can step 2 of this reproducer trigger the bug?
On a connection-oriented socket, bind goes through
tipc_bind()->tipc_sk_bind()->__tipc_bind()->tipc_sk_publish(), which
does this:
net/tipc/socket.c:tipc_sk_publish() {
...
tsk->published = true;
return 0;
}
In __tipc_sendmsg(), the syn branch checks published before it gets to
the new service range check:
if (tsk->published)
return -EOPNOTSUPP;
if (atype == TIPC_SERVICE_RANGE)
return -EINVAL;
So a client that binds first gets -EOPNOTSUPP from sendto() whether or
not this patch is applied, and the server never receives anything.
The path this patch closes seems to be an unbound SOCK_STREAM or
SOCK_SEQPACKET client that calls sendto() or sendmsg() with a
TIPC_SERVICE_RANGE destination. The code change looks correct for that
case.
Should step 2 say that the client sends to a service range, rather than
binds to one?
> However, the current implementation allows a client to send a SYN or an implicit
> connection message using a service range.
Is the explicit SYN part of this sentence accurate? tipc_connect()
already rejects service ranges on connection-oriented sockets:
net/tipc/socket.c:tipc_connect() {
...
} else if (dst->addrtype == TIPC_SERVICE_RANGE) {
res = -EINVAL;
goto exit;
}
...
}
It looks like only the implicit connect through sendmsg() was open.
The second patch in the series, "tipc: reject SYN sent from a
connection-oriented socket to a datagram server", only changes
tipc_sk_filter_rcv(), so it does not affect this.
[ ... ]
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> --- 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);
[Severity: Low]
Is b97bf3fd8f6a the right commit for the Fixes tag?
In the initial merge, send_msg() already refused TIPC_ADDR_MCAST (the
old name for TIPC_SERVICE_RANGE) on connection-oriented sockets:
if (needs_conn) {
res = -EOPNOTSUPP;
goto exit;
}
That guard survived e2dafe87d328 ("tipc: RDM/DGRAM transport uses new
fragmenting and sending functions"). That commit split the multicast
path out into tipc_sendmcast() and kept a sock->state != SS_READY test
there that returned -EOPNOTSUPP.
The protection appears to have been lost in 0abd8ff21f19 ("tipc: start
using the new multicast functions"). That commit rewrote
tipc_sendmcast() and dropped the SS_READY check without adding an
equivalent one in tipc_sendmsg(). That seems to be the first point
where an unconnected SOCK_STREAM or SOCK_SEQPACKET socket could reach
tipc_sendmcast() with a service range destination.
If that history is right, should the tag be:
Fixes: 0abd8ff21f19 ("tipc: start using the new multicast functions")
There is no runtime impact either way. However, blaming the initial
merge misleads anyone tracing where the regression came from. It also
misleads the tooling that uses the Fixes tag to decide which trees
need the backport.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40est.tech