Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53445bb3 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford
Browse files

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: default avatarDean Luick <dean.luick@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent a7cd2dc5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -472,8 +472,8 @@ int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd)
	hfi1_cdbg(SDMA, "[%u:%u:%u] Freeing user SDMA queues", uctxt->dd->unit,
		  uctxt->ctxt, fd->subctxt);
	pq = fd->pq;
	hfi1_mmu_rb_unregister(&pq->sdma_rb_root);
	if (pq) {
		hfi1_mmu_rb_unregister(&pq->sdma_rb_root);
		spin_lock_irqsave(&uctxt->sdma_qlock, flags);
		if (!list_empty(&pq->list))
			list_del_init(&pq->list);