linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Zhang <markzhang@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	<linux-kernel@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
	Sean Hefty <sean.hefty@intel.com>
Subject: Re: [PATCH rdma-next v3 8/8] IB/cm: Protect cm_dev, cm_ports and mad_agent with kref and lock
Date: Wed, 26 May 2021 10:46:47 +0800	[thread overview]
Message-ID: <3bea531d-ab6d-3990-2014-02c7a4a1679c@nvidia.com> (raw)
In-Reply-To: <20210525200057.GA3469742@nvidia.com>

On 5/26/2021 4:00 AM, Jason Gunthorpe wrote:
> On Tue, May 11, 2021 at 11:22:12AM +0300, Leon Romanovsky wrote:
>> @@ -2139,6 +2197,8 @@ static int cm_req_handler(struct cm_work *work)
>>   		sa_path_set_dmac(&work->path[0],
>>   				 cm_id_priv->av.ah_attr.roce.dmac);
>>   	work->path[0].hop_limit = grh->hop_limit;
>> +
>> +	cm_destroy_av(&cm_id_priv->av);
>>   	ret = cm_init_av_by_path(&work->path[0], gid_attr, &cm_id_priv->av);
>>   	if (ret) {
>>   		int err;
> 
> Why add cm_destroy_av() here? The cm_id_priv was freshly created at
> the top of this function and hasn't left the stack frame yet?
> 
Because it was initialized by cm_init_av_for_response() previously, so 
destroy it here as cm_init_av_by_path() will re-initialize it.



  reply	other threads:[~2021-05-26  2:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  8:22 [PATCH rdma-next v3 0/8] Fix memory corruption in CM Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 1/8] IB/cm: Pair cm_alloc_response_msg() with a cm_free_response_msg() Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 2/8] IB/cm: Split cm_alloc_msg() Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 3/8] IB/cm: Call the correct message free functions in cm_send_handler() Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 4/8] IB/cm: Tidy remaining cm_msg free paths Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 5/8] Revert "IB/cm: Mark stale CM id's whenever the mad agent was unregistered" Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 6/8] IB/cm: Simplify ib_cancel_mad() and ib_modify_mad() calls Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 7/8] IB/cm: Improve the calling of cm_init_av_for_lap and cm_init_av_by_path Leon Romanovsky
2021-05-11  8:22 ` [PATCH rdma-next v3 8/8] IB/cm: Protect cm_dev, cm_ports and mad_agent with kref and lock Leon Romanovsky
2021-05-25 20:00   ` Jason Gunthorpe
2021-05-26  2:46     ` Mark Zhang [this message]
2021-05-26 16:16       ` Jason Gunthorpe

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=3bea531d-ab6d-3990-2014-02c7a4a1679c@nvidia.com \
    --to=markzhang@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.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;
as well as URLs for NNTP newsgroup(s).