From: Jason Gunthorpe <jgg@nvidia.com>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: Yishai Hadas <yishaih@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Roland Dreier <roland@purestorage.com>,
Jack Morgenstein <jackm@dev.mellanox.co.il>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] IB/mlx4: Fix refcount leak in add_port() error path
Date: Tue, 28 Apr 2026 11:35:40 -0300 [thread overview]
Message-ID: <20260428143540.GA2647286@nvidia.com> (raw)
In-Reply-To: <20260413115949.2799399-1-lgs201920130244@gmail.com>
On Mon, Apr 13, 2026 at 07:59:48PM +0800, Guangshuo Li wrote:
> @@ -642,7 +642,7 @@ static int add_port(struct mlx4_ib_dev *dev, int port_num, int slave)
> kobject_get(dev->dev_ports_parent[slave]),
> "%d", port_num);
> if (ret)
> - goto err_alloc;
> + goto err_kobj;
>
> p->pkey_group.name = "pkey_idx";
> p->pkey_group.attrs =
> @@ -689,6 +689,11 @@ static int add_port(struct mlx4_ib_dev *dev, int port_num, int slave)
> kobject_put(dev->dev_ports_parent[slave]);
> kfree(p);
> return ret;
> +
> +err_kobj:
> + kobject_put(&p->kobj);
Sashiko says this will crash because this was skipped:
p->pkey_group.attrs =
alloc_group_attrs(show_port_pkey,
is_eth ? NULL : store_port_pkey,
dev->dev->caps.pkey_table_len[port_num]);
Along with other problems.
Jason
next prev parent reply other threads:[~2026-04-28 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 11:59 [PATCH v2] IB/mlx4: Fix refcount leak in add_port() error path Guangshuo Li
2026-04-28 14:35 ` Jason Gunthorpe [this message]
2026-04-28 15:37 ` Guangshuo Li
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=20260428143540.GA2647286@nvidia.com \
--to=jgg@nvidia.com \
--cc=jackm@dev.mellanox.co.il \
--cc=leon@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=roland@purestorage.com \
--cc=stable@vger.kernel.org \
--cc=yishaih@nvidia.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