From: Paolo Abeni <pabeni@redhat.com>
To: Tung Nguyen <tung.quang.nguyen@est.tech>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@kernel.org,
jmaloy@redhat.com, horms@kernel.org,
tipc-discussion@lists.sourceforge.net,
syzbot+64197f7577a09686ffdb@syzkaller.appspotmail.com
Subject: Re: [PATCH net 2/2] tipc: fix NULL pointer dereference in named_distribute()
Date: Thu, 29 Oct 2026 15:10:55 +0100 [thread overview]
Message-ID: <e0347015-0b0f-4a87-92ce-ea5e4868cf2a@redhat.com> (raw)
In-Reply-To: <20261028033722.125477-3-tung.quang.nguyen@est.tech>
On 10/28/26 04:36, Tung Nguyen wrote:
> +/**
> + * tipc_nametb_insert_self_node_pub - insert publication of node's self address
> + * @net: network namespace
> + *
> + * Return:
> + * * 0 - Success
> + * * -ENOBUFS - No buffer space is available
> + *
> + */
> +int tipc_nametb_insert_self_node_pub(struct net *net)
> +{
> + struct name_table *nt = tipc_name_table(net);
> + struct tipc_net *tn = tipc_net(net);
> + struct tipc_socket_addr sk;
> + struct service_range *sr;
> + struct tipc_service *sc;
> + bool sc_created = false;
> + struct publication *p;
> + struct tipc_uaddr ua;
> + int err = 0;
> +
> + sk.ref = 0;
> + sk.node = tn->node_addr;
> + tipc_uaddr(&ua, TIPC_SERVICE_RANGE, TIPC_CLUSTER_SCOPE,
> + TIPC_NODE_STATE, tn->node_addr, tn->node_addr);
> + sc = tipc_service_find(net, &ua);
> + if (!sc) {
> + sc = tipc_service_create(net, &ua);
> + if (!sc)
> + return -ENOBUFS;
> + sc_created = true;
> + }
> +
> + spin_lock_bh(&sc->lock);
> + sr = tipc_service_find_range(sc, &ua);
> + /* 1. tipc_net_finalize_work() is not scheduled because of namespace
> + * teardown.
> + * 2. Or tipc_net_finalize() ---> tipc_nametbl_publish() has failed
> + * to insert node self address publication into nt->cluster_scope
> + * due to memory allocation failure.
> + * 3. Or tipc_net_finalize() ---> tipc_nametbl_publish() has not
> + * executed yet.
> + */
> + if (!sr) {
> + p = tipc_publ_create(&ua, &sk, tn->node_addr);
> + if (!p)
> + goto error;
> +
> + if (!tipc_service_insert_publ(net, sc, p, &err)) {
> + kfree(p);
> + goto error;
> + }
> +
> + list_add_tail(&p->binding_node, &nt->cluster_scope);
> + goto exit;
> +error:
> + if (sc_created) {
The above is a bit ugly. AFAICS you avoid the unneeded label `exit`
moving this error path, label included, after the `return 0;` statement.
Also sashiko complains look legit.
/P
prev parent reply other threads:[~2026-10-29 14:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 3:36 [PATCH net 0/2] tipc: fix deadlock and NUll pointer dereference in tipc_named_node_up() Tung Nguyen
2026-10-28 3:36 ` [PATCH net 1/2] tipc: fix self-deadlock in tipc_named_node_up Tung Nguyen
2026-10-29 4:27 ` netdev-bot+sashiko
2026-10-28 3:36 ` [PATCH net 2/2] tipc: fix NULL pointer dereference in named_distribute() Tung Nguyen
2026-10-29 4:27 ` netdev-bot+sashiko
2026-10-29 14:10 ` Paolo Abeni [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=e0347015-0b0f-4a87-92ce-ea5e4868cf2a@redhat.com \
--to=pabeni@redhat.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=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