public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Doug Ledford <dledford@redhat.com>,
	Mark Zhang <markzhang@nvidia.com>,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next 3/6] IB/cm: Remove "mad_agent" parameter of ib_modify_mad
Date: Thu, 1 Apr 2021 11:12:43 +0300	[thread overview]
Message-ID: <YGWAexN7nZx5ac9J@unreal> (raw)
In-Reply-To: <20210329124101.GA887238@nvidia.com>

On Mon, Mar 29, 2021 at 09:41:01AM -0300, Jason Gunthorpe wrote:
> On Thu, Mar 18, 2021 at 12:03:06PM +0200, Leon Romanovsky wrote:
> 
> > +static void cm_send_free_msg(struct ib_mad_send_buf *msg)
> > +{
> > +	struct cm_id_private *cm_id_priv;
> > +
> > +	cm_id_priv = msg->context[0];
> > +	if (!cm_id_priv || cm_id_priv->msg != msg) {
> > +		cm_free_msg(msg);
> > +		return;
> > +	}
> > +
> > +	spin_lock_irq(&cm_id_priv->lock);
> > +	cm_free_msg(msg);
> > +	cm_id_priv->msg = NULL;
> > +	spin_unlock_irq(&cm_id_priv->lock);
> > +}
> 
> Either the whole sequence should be inside the lock or nothing should
> be in the lock..

I see the race now, thanks for pointing it.

> 
> Oh this is all messed up and needs a big fix. Review and include this
> in the series and drop the above function.
> 
> https://github.com/jgunthorpe/linux/commits/for-markz

We will take a look on it.

Thanks

> 
> Jason

  reply	other threads:[~2021-04-01  8:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 10:03 [PATCH rdma-next 0/6] Fix memory corruption in CM Leon Romanovsky
2021-03-18 10:03 ` [PATCH rdma-next 1/6] Revert "IB/cm: Mark stale CM id's whenever the mad agent was unregistered" Leon Romanovsky
2021-03-18 10:03 ` [PATCH rdma-next 2/6] IB/cm: Remove "mad_agent" parameter of ib_cancel_mad Leon Romanovsky
2021-03-26 20:24   ` Jason Gunthorpe
2021-03-18 10:03 ` [PATCH rdma-next 3/6] IB/cm: Remove "mad_agent" parameter of ib_modify_mad Leon Romanovsky
2021-03-29 12:41   ` Jason Gunthorpe
2021-04-01  8:12     ` Leon Romanovsky [this message]
2021-03-18 10:03 ` [PATCH rdma-next 4/6] IB/cm: Clear all associated AV's ports when remove a cm device Leon Romanovsky
2021-03-18 10:03 ` [PATCH rdma-next 5/6] IB/cm: Add lock protection when access av/alt_av's port of a cm_id Leon Romanovsky
2021-03-18 10:03 ` [PATCH rdma-next 6/6] IB/cm: Initialize av before acquire the spin lock in cm_lap_handler 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=YGWAexN7nZx5ac9J@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=markzhang@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