public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: "Ruhl, Michael J" <michael.j.ruhl@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	"Marciniszyn, Mike" <mike.marciniszyn@intel.com>
Cc: "Dalessandro, Dennis" <dennis.dalessandro@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH v2] IB/hfi1: Prevent a NULL dereference
Date: Wed, 10 Jan 2018 17:03:29 -0500	[thread overview]
Message-ID: <1515621809.3403.175.camel@redhat.com> (raw)
In-Reply-To: <14063C7AD467DE4B82DEDB5C278E8663A9F7FC30@fmsmsx107.amr.corp.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]

On Tue, 2018-01-09 at 20:39 +0000, Ruhl, Michael J wrote:
> > -----Original Message-----
> > From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> > owner@vger.kernel.org] On Behalf Of Dan Carpenter
> > Sent: Tuesday, January 9, 2018 3:04 PM
> > To: Marciniszyn, Mike <mike.marciniszyn@intel.com>
> > Cc: Dalessandro, Dennis <dennis.dalessandro@intel.com>; Doug Ledford
> > <dledford@redhat.com>; Jason Gunthorpe <jgg@ziepe.ca>; linux-
> > rdma@vger.kernel.org; kernel-janitors@vger.kernel.org
> > Subject: [PATCH v2] IB/hfi1: Prevent a NULL dereference
> > 
> > In the original code, we set "fd->uctxt" to NULL and then dereference it
> > which will cause an Oops.
> > 
> > Fixes: f2a3bc00a03c ("IB/hfi1: Protect context array set/clear with spinlock")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: In v1, I accidentally moved the __clear_bit() out from under the
> >     spin_lock().  Thanks for the review, Michael!
> > 
> > diff --git a/drivers/infiniband/hw/hfi1/file_ops.c
> > b/drivers/infiniband/hw/hfi1/file_ops.c
> > index 82086241aac3..bd6f03cc5ee0 100644
> > --- a/drivers/infiniband/hw/hfi1/file_ops.c
> > +++ b/drivers/infiniband/hw/hfi1/file_ops.c
> > @@ -763,11 +763,11 @@ static int complete_subctxt(struct hfi1_filedata *fd)
> >  	}
> > 
> >  	if (ret) {
> > -		hfi1_rcd_put(fd->uctxt);
> > -		fd->uctxt = NULL;
> >  		spin_lock_irqsave(&fd->dd->uctxt_lock, flags);
> >  		__clear_bit(fd->subctxt, fd->uctxt->in_use_ctxts);
> >  		spin_unlock_irqrestore(&fd->dd->uctxt_lock, flags);
> > +		hfi1_rcd_put(fd->uctxt);
> > +		fd->uctxt = NULL;
> >  	}
> > 
> >  	return ret;
> > --
> 
> Cc: <stable@vger.kernel.org> # 4.14.x

Unfortunately, patchworks doesn't pick up additional Cc: tags, only
reviewed-bys and acks.  In any case, I hand added it.  Thanks, applied
to for-rc.

> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> 
> Looks good.  Adding tag for stable too.
> 
> Thanks,
> 
> Mike
> 
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2018-01-10 22:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09  9:27 [PATCH] IB/hfi1: Prevent a NULL dereference Dan Carpenter
2018-01-09 14:02 ` Dennis Dalessandro
2018-01-09 14:16 ` Ruhl, Michael J
2018-01-09 14:23   ` Dan Carpenter
     [not found]   ` <14063C7AD467DE4B82DEDB5C278E8663A9F7F391-96pTJSsuoYRzLByeVOV5+bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2018-01-09 20:03     ` [PATCH v2] " Dan Carpenter
2018-01-09 20:39       ` Ruhl, Michael J
2018-01-10 22:03         ` Doug Ledford [this message]

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=1515621809.3403.175.camel@redhat.com \
    --to=dledford@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dennis.dalessandro@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michael.j.ruhl@intel.com \
    --cc=mike.marciniszyn@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