Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
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).
- [High] This patch has no effect: a datagram server still accepts the
SYN that the commit message says it rejects.
--
tipc: reject SYN sent from a connection-oriented socket to a datagram server
The patch tries to make a connectionless (SOCK_RDM/SOCK_DGRAM) TIPC
server socket reject SYN or implicit-connect messages from
connection-oriented clients with TIPC_ERR_NO_PORT. To do this it adds a
clause to the receive filter in tipc_sk_filter_rcv().
Closes: https://lore.kernel.org/netdev/2026…@stellman-greene.com/
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index 4ed895b75bf3a..e606954fbd2c3 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -2379,6 +2379,8 @@ 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_connected(hdr) &&
> + (mtyp == TIPC_NAMED_MSG || mtyp == TIPC_DIRECT_MSG)) ||
> (!sk_conn && msg_connected(hdr)) ||
[Severity: High]
Can this new clause ever be true for a SYN?
msg_connected() only checks the message type:
net/tipc/msg.h:
static inline u32 msg_connected(struct tipc_msg *m)
{
return msg_type(m) == TIPC_CONN_MSG;
}
The SYN built by __tipc_sendmsg() is never a TIPC_CONN_MSG. It is a
NAMED or DIRECT message with the SYN bit set:
net/tipc/socket.c:__tipc_sendmsg() {
...
msg_set_syn(hdr, 1);
...
if (atype == TIPC_SERVICE_ADDR) {
msg_set_type(hdr, TIPC_NAMED_MSG);
...
} else { /* TIPC_SOCKET_ADDR */
msg_set_type(hdr, TIPC_DIRECT_MSG);
...
}
So msg_connected(hdr) is false for every SYN, and the new clause is
false too.
Whenever the new clause is true, the unchanged line after it is also
true:
(!sk_conn && msg_connected(hdr))
As a result, the set of rejected messages looks the same as before the
patch. A SOCK_RDM or SOCK_DGRAM server would still add the SYN-flagged
NAMED/DIRECT message to sk_receive_queue. Would the reproducer in the
commit message still show the problem?
There is a second issue with the clause. mtyp is read once, from the
first skb, before the dequeue loop:
int mtyp = msg_type(hdr);
The loop never reads it again for the skb it is checking.
Was the intent to test msg_is_syn(hdr), together with a type check on
the current skb's header? The type check matters because
tipc_mcast_send_sync() in net/tipc/bcast.c also sets the SYN bit, on
TIPC_MCAST_MSG headers that connectionless sockets legitimately receive:
/* Preparing for 'synching' header */
msg_set_syn(hdr, 1);
A plain !sk_conn && msg_is_syn(hdr) test would also reject that
multicast traffic.
> (!grp && msg_in_group(hdr)))
> err = TIPC_ERR_NO_PORT;
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40est.tech