linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>
Cc: Maor Gottlieb <maorg@nvidia.com>,
	linux-rdma@vger.kernel.org,
	"Nicholas A. Bellinger" <nab@risingtidesystems.com>,
	target-devel@vger.kernel.org
Subject: Re: [PATCH rdma-next] IB/srpt: Fix memory leak in srpt_add_one
Date: Mon, 26 Oct 2020 19:22:07 -0700	[thread overview]
Message-ID: <93385ff4-cab7-05f2-e29a-82c9c71e47fa@acm.org> (raw)
In-Reply-To: <20201026132737.1338171-1-leon@kernel.org>

On 10/26/20 6:27 AM, Leon Romanovsky wrote:
> From: Maor Gottlieb <maorg@nvidia.com>
> 
> In case srpt_refresh_port failed for the second port, then
> we don't unregister the MAD agnet.
                              ^^^^^
                              agent?

The commit message is incomplete. Why does this patch have a Fixes tag?
The commit message should explain this but doesn't explain this.

What does this patch actually change? ib_unregister_mad_agent() is only
called by the current code if sport->mad_agent != NULL.

> -static void srpt_unregister_mad_agent(struct srpt_device *sdev)
> +static void __srpt_unregister_mad_agent(struct srpt_device *sdev, int port_cnt)
>  {
>  	struct ib_port_modify port_modify = {
>  		.clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP,
> @@ -633,7 +627,10 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev)
>  	struct srpt_port *sport;
>  	int i;
>  
> -	for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
> +	if (!port_cnt)
> +		return;
> +
> +	for (i = 1; i <= port_cnt; i++) {
>  		sport = &sdev->port[i - 1];
>  		WARN_ON(sport->port != i);
>  		if (sport->mad_agent) {

If this patch is retained, please leave the if-test out if you agree
that it is not necessary. I'm concerned that it will confuse readers.

Thanks,

Bart.

  reply	other threads:[~2020-10-27  2:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 13:27 [PATCH rdma-next] IB/srpt: Fix memory leak in srpt_add_one Leon Romanovsky
2020-10-27  2:22 ` Bart Van Assche [this message]
2020-10-27  5:34   ` Leon Romanovsky

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=93385ff4-cab7-05f2-e29a-82c9c71e47fa@acm.org \
    --to=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=nab@risingtidesystems.com \
    --cc=target-devel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).