Browse Source

IB/core: Free umem when mm is already gone

Free umem when task's mm is already destroyed by the time
ib_umem_release gets called.

Found by Dotan Barak at Mellanox.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Eli Cohen 18 years ago
parent
commit
7b82cd8ee7
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/infiniband/core/umem.c

+ 3 - 1
drivers/infiniband/core/umem.c

@@ -209,8 +209,10 @@ void ib_umem_release(struct ib_umem *umem)
 	__ib_umem_release(umem->context->device, umem, 1);
 	__ib_umem_release(umem->context->device, umem, 1);
 
 
 	mm = get_task_mm(current);
 	mm = get_task_mm(current);
-	if (!mm)
+	if (!mm) {
+		kfree(umem);
 		return;
 		return;
+	}
 
 
 	diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT;
 	diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT;