Message ID | 20180109092714.valolokywtmbprw7@mwanda (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On 1/9/2018 4:27 AM, Dan Carpenter wrote: > 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> > > diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c > index 82086241aac3..3de1ac94bb85 100644 > --- a/drivers/infiniband/hw/hfi1/file_ops.c > +++ b/drivers/infiniband/hw/hfi1/file_ops.c > @@ -763,10 +763,10 @@ static int complete_subctxt(struct hfi1_filedata *fd) > } > > if (ret) { > + __clear_bit(fd->subctxt, fd->uctxt->in_use_ctxts); > 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); > } > > Thanks! Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com> -- 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
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index 82086241aac3..3de1ac94bb85 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -763,10 +763,10 @@ static int complete_subctxt(struct hfi1_filedata *fd) } if (ret) { + __clear_bit(fd->subctxt, fd->uctxt->in_use_ctxts); 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); }
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> -- 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