diff options
author | Ira Weiny <ira.weiny@intel.com> | 2016-07-28 15:21:12 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-08-02 22:46:21 -0400 |
commit | 53445bb32d244b1b32e8d88346a551130fb35544 (patch) | |
tree | d693acb239cf1e977333da876a912c38ed16943f /drivers/infiniband | |
parent | a7cd2dc5d494e92871e7b6734b72ef5451ff026d (diff) |
IB/hfi1: Prevent null pointer dereference
If a context has not been assigned or assignment failed, pq may be NULL.
Move the unregister within the protection of the null check.
Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/hfi1/user_sdma.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index 586f07807b27..6b8d1e8b6286 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c | |||
@@ -472,8 +472,8 @@ int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd) | |||
472 | hfi1_cdbg(SDMA, "[%u:%u:%u] Freeing user SDMA queues", uctxt->dd->unit, | 472 | hfi1_cdbg(SDMA, "[%u:%u:%u] Freeing user SDMA queues", uctxt->dd->unit, |
473 | uctxt->ctxt, fd->subctxt); | 473 | uctxt->ctxt, fd->subctxt); |
474 | pq = fd->pq; | 474 | pq = fd->pq; |
475 | hfi1_mmu_rb_unregister(&pq->sdma_rb_root); | ||
476 | if (pq) { | 475 | if (pq) { |
476 | hfi1_mmu_rb_unregister(&pq->sdma_rb_root); | ||
477 | spin_lock_irqsave(&uctxt->sdma_qlock, flags); | 477 | spin_lock_irqsave(&uctxt->sdma_qlock, flags); |
478 | if (!list_empty(&pq->list)) | 478 | if (!list_empty(&pq->list)) |
479 | list_del_init(&pq->list); | 479 | list_del_init(&pq->list); |