From: Mitko Haralanov Date: Tue, 8 Mar 2016 19:14:31 +0000 (-0800) Subject: IB/hfi1: Prevent NULL pointer dereference X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4b00d9490f2147d29f107f36391b0cc77bcd944f;p=linux-beck.git 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 Reviewed-by: Dean Luick Signed-off-by: Mitko Haralanov Signed-off-by: Jubin John Signed-off-by: Doug Ledford --- 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);