Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tung.quang.nguyen@est.tech
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	edumazet@kernel.org, pabeni@redhat.com, jmaloy@redhat.com,
	horms@kernel.org, tipc-discussion@lists.sourceforge.net,
	willemb@google.com, astellman@stellman-greene.com
Subject: Re: [PATCH net v2 2/2] tipc: reject SYN sent from a connection-oriented socket to a datagram server
Date: Sat, 05 Dec 2026 01:11:46 +0000	[thread overview]
Message-ID: <179643310693.3146.4275269356282190125@kernel.org> (raw)
In-Reply-To: <20261204003240.63452-3-tung.quang.nguyen@est.tech>

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/20261129144901.90934-1-bugs@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/20261204003240.63452-1-tung.quang.nguyen%40est.tech

      parent reply	other threads:[~2026-12-05  1:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  0:29 [PATCH net v2 0/2] tipc: reject invalid use cases in connection-oriented client/server communication Tung Nguyen
2026-12-04  0:29 ` [PATCH net v2 1/2] tipc: reject service-range SYN sent from connection-oriented socket Tung Nguyen
2026-12-05  1:11   ` netdev-bot+sashiko
2026-12-05  1:37     ` Tung Quang Nguyen
2026-12-04  0:29 ` [PATCH net v2 2/2] tipc: reject SYN sent from a connection-oriented socket to a datagram server Tung Nguyen
2026-12-04  1:17   ` Andrew Stellman
2026-12-04  1:27     ` Tung Quang Nguyen
2026-12-05  1:11   ` 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=179643310693.3146.4275269356282190125@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=astellman@stellman-greene.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jmaloy@redhat.com \
    --cc=kuba@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 \
    /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