summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorMitko Haralanov <mitko.haralanov@intel.com>2016-03-08 11:14:31 -0800
committerDoug Ledford <dledford@redhat.com>2016-03-21 15:55:20 -0400
commit4b00d9490f2147d29f107f36391b0cc77bcd944f (patch)
treee775eae8cb7c750a608aea9dd4e5a5f6b979df0d /drivers/staging
parentc81e1f6452406a633b7c4ea3e0a12e5deaf57f5c (diff)
IB/hfi1: Prevent NULL pointer dereference
Prevent a potential NULL pointer dereference (found by code inspection) when unregistering an MMU handler. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Reviewed-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com> Signed-off-by: Jubin John <jubin.john@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rdma/hfi1/mmu_rb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/rdma/hfi1/mmu_rb.c b/drivers/staging/rdma/hfi1/mmu_rb.c
index 648f7e0a1d17..f42a33b55dc4 100644
--- a/drivers/staging/rdma/hfi1/mmu_rb.c
+++ b/drivers/staging/rdma/hfi1/mmu_rb.c
@@ -107,6 +107,9 @@ void hfi1_mmu_rb_unregister(struct rb_root *root)
struct mmu_rb_handler *handler = find_mmu_handler(root);
unsigned long flags;
+ if (!handler)
+ return;
+
spin_lock_irqsave(&mmu_rb_lock, flags);
list_del(&handler->list);
spin_unlock_irqrestore(&mmu_rb_lock, flags);