Re: [PATCH net-next v3 2/2] net/rds: Give each connection path its own workqueue

Allison Henderson
2025-12-02T22:28:23Z

On Tue, 2025-12-02 at 15:10 +0000, Simon Horman wrote:
> On Sun, Nov 30, 2025 at 11:10:36PM -0700, Allison Henderson wrote:
>
> ...
>
> > diff --git a/net/rds/connection.c b/net/rds/connection.c
> > index dc7323707f450..cfe6b50db8a6f 100644
> > --- a/net/rds/connection.c
> > +++ b/net/rds/connection.c
> > @@ -269,7 +269,11 @@ static struct rds_connection *__rds_conn_create(struct net *net,
> > __rds_conn_path_init(conn, &conn->c_path[i],
> > is_outgoing);
> > conn->c_path[i].cp_index = i;
> > - conn->c_path[i].cp_wq = rds_wq;
> > + conn->c_path[i].cp_wq =
> > + alloc_ordered_workqueue("krds_cp_wq#%lu/%d", 0,
> > + rds_conn_count, i);
> > + if (!conn->c_path[i].cp_wq)
> > + conn->c_path[i].cp_wq = rds_wq;
> > }
> > rcu_read_lock();
> > if (rds_destroy_pending(conn))
>
> Hi Allison,
>
> The code following the hunk above looks like this:
>
> ret = -ENETDOWN;
> else
> ret = trans->conn_alloc(conn, GFP_ATOMIC);
> if (ret) {
> rcu_read_unlock();
> kfree(conn->c_path);
> kmem_cache_free(rds_conn_slab, conn);
> conn = ERR_PTR(ret);
> goto out;
> }
>
> There are no more error paths that free resources in the remainder of
> the function. And the out label simply returns conn.
>
> It looks like the ordered workqueue allocation added by this patch
> will be leaked if we reach the error condition above.
>
> Flagged by Code Spell with review prompts.
>
> https://urldefense.com/v3/__https://netdev-ai.bots.linux.dev/ai-review.html?id=89a5d15b-cd8c-4403-81ff-8577dc0069a6*patch-1__;Iw!!ACWV5N9M2RV99hQ!KnPqisPP6XfmV5F6LJJAri_f4-kTCKqDcHE4IWxZxNjLu5hECsHolnFkelLryzlQL9WMl4YZVuftHKE1RjM$
>
Hi Simon,

Yes, I noticed the patch work warning. I will fix the error path and repost in a couple weeks. Thank you!

Allison

> ...
>
> Also, please note that net-next is currently closed for the merge window.
> So the usual guidance about that applies:
>
> ## Form letter - net-next-closed
>
> The merge window for v6.19 has begun and therefore net-next is closed
> for new drivers, features, code refactoring and optimizations. We are
> currently accepting bug fixes only.
>
> Please repost when net-next reopens after 15th December.
>
> RFC patches sent for review only are obviously welcome at any time.
>
> See: https://urldefense.com/v3/__https://www.kernel.org/doc/html/next/process/maintainer-netdev.html*development-cycle__;Iw!!ACWV5N9M2RV99hQ!KnPqisPP6XfmV5F6LJJAri_f4-kTCKqDcHE4IWxZxNjLu5hECsHolnFkelLryzlQL9WMl4YZVuft11YRP3A$
>