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,
	syzbot+64197f7577a09686ffdb@syzkaller.appspotmail.com,
	lkp@intel.com
Subject: Re: [PATCH net v3 2/7] tipc: fix dangling link in cluster_scope list in tipc_service_delete()
Date: Tue, 17 Nov 2026 18:37:53 +0000	[thread overview]
Message-ID: <179494067383.3136.15883783633463671421@kernel.org> (raw)
In-Reply-To: <20261116063529.6185-3-tung.quang.nguyen@est.tech>

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 presents this change as a bug fix and carries
  a Fixes: tag (1bb8dce57f4d), but it names no consequence anyone could…

--

tipc: fix dangling link in cluster_scope list in tipc_service_delete()

This patch makes tipc_service_delete() remove the local node's own
TIPC_NODE_STATE publication from nt->cluster_scope before it is freed
with kfree_rcu(). The commit message calls the leftover entry a
dangling list entry and adds a Fixes: tag for 1bb8dce57f4d.

> diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
> index 6fda36ab17669..73b032ba2f8d0 100644
> --- a/net/tipc/name_table.c
> +++ b/net/tipc/name_table.c

[ ... ]

> @@ -941,6 +942,13 @@ static void tipc_service_delete(struct net *net, struct tipc_service *sc)
>  	rbtree_postorder_for_each_entry_safe(sr, tmpr, &sc->ranges, tree_node) {
>  		list_for_each_entry_safe(p, tmp, &sr->all_publ, all_publ) {
>  			tipc_service_remove_publ(sr, &p->sk, p->key);
> +			if (p->sr.type == TIPC_NODE_STATE &&
> +			    p->sr.lower == tn->node_addr &&
> +			    p->sr.upper == tn->node_addr &&
> +			    p->key == tn->node_addr &&
> +			    p->sk.ref == 0 && p->sk.node == tn->node_addr)
> +				list_del(&p->binding_node);
> +
>  			kfree_rcu(p, rcu);
>  		}
>  		rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks);

[Severity: Low]

Can anything actually reach the leftover cluster_scope entry?

tipc_service_delete() is only called from tipc_nametbl_stop(). That
function frees the name table, including the cluster_scope list head,
right after the purge loop:

net/tipc/name_table.c:tipc_nametbl_stop() {
    ...
	spin_unlock_bh(&tn->nametbl_lock);

	/* TODO: clear tn->nametbl, implement proper RCU rules ? */
	kfree_rcu(nt, rcu);
}

tipc_nametbl_stop() is called from the tipc_init_net() error path and
from tipc_exit_net():

net/tipc/core.c:tipc_exit_net() {
    ...
	tipc_net_stop(net);
	/* Make sure the tipc_net_finalize_work() finished */
	cancel_work_sync(&tn->work);
	tipc_bcast_stop(net);
	tipc_nametbl_stop(net);
    ...
}

By that point tipc_net_stop() has already removed the bearers and
nodes, so tipc_named_node_up() can't run. cancel_work_sync() has
stopped tn->work, so tipc_named_reinit() can't run either.
tipc_named_publish() and tipc_named_withdraw() only run from socket
operations.

Is there a path that walks nt->cluster_scope between the purge and
kfree_rcu(nt, rcu), or after it?

If there isn't, this looks like cleanup at teardown rather than a fix
for a bug that can be hit. Should the commit message describe a failure
that can be observed? If not, could it present this as cleanup and drop
the Fixes: tag, so stable trees don't pick it up?

Separately, the commit message says:

  Fix this by calling list_del() before freeing TIPC_NODE_STATE
  publications in tipc_service_delete().

The code only removes the local node's own publication: type
TIPC_NODE_STATE, lower == upper == key == sk.node == tn->node_addr, and
sk.ref == 0. Remote TIPC_NODE_STATE publications are left alone. That
looks correct, because their binding_node sits on the peer node's
publ_list.

Could that sentence name the self-node publication specifically?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116063529.6185-1-tung.quang.nguyen%40est.tech

  reply	other threads:[~2026-11-17 18:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  6:34 [PATCH net v3 0/7] tipc: fix deadlock and NUll pointer dereference in tipc_named_node_up() Tung Nguyen
2026-11-16  6:34 ` [PATCH net v3 1/7] tipc: fix memory leak in tipc_node_xmit() Tung Nguyen
2026-11-16  6:34 ` [PATCH net v3 2/7] tipc: fix dangling link in cluster_scope list in tipc_service_delete() Tung Nguyen
2026-11-17 18:37   ` netdev-bot+sashiko [this message]
2026-11-16  6:34 ` [PATCH net v3 3/7] tipc: fix incorrect initialization of replicast node counter Tung Nguyen
2026-11-16  6:34 ` [PATCH net v3 4/7] tipc: fix missing link-up event on memory allocation failure Tung Nguyen
2026-11-17 18:37   ` netdev-bot+sashiko
2026-11-16  6:34 ` [PATCH net v3 5/7] tipc: validate original address of received skb in tipc_named_rcv() Tung Nguyen
2026-11-17 18:37   ` netdev-bot+sashiko
2026-11-16  6:34 ` [PATCH net v3 6/7] tipc: fix self-deadlock in tipc_named_node_up Tung Nguyen
2026-11-17 18:37   ` netdev-bot+sashiko
2026-11-16  6:34 ` [PATCH net v3 7/7] tipc: fix NULL pointer dereference in named_distribute() Tung Nguyen
2026-11-17 18:37   ` netdev-bot+sashiko

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=179494067383.3136.15883783633463671421@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jmaloy@redhat.com \
    --cc=kuba@kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+64197f7577a09686ffdb@syzkaller.appspotmail.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=tung.quang.nguyen@est.tech \
    /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