Skip to contentSkip to conversation

RDMA/odp: Fix leaking the tgid for implicit ODP

PATCH Applied Jason Gunthorpe 2 participants 2 messages Mar 4, 2020 – Mar 10, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/odp: Fix leaking the tgid for implicit ODP

The tgid used to be part of ib_umem_free_notifier(), when it was reworked it got moved to release, but it should have been unconditional as all umem alloc paths get the tgid.

As is, creating an implicit ODP will leak the tgid reference.

Fixes f25a546e6529 ("RDMA/odp: Use mmu_interval_notifier_insert()")
---
 drivers/infiniband/core/umem_odp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/umem_odp.c +1 -1
index cd656ad4953bfc..3b1e627d9a8dd5 100644
@@ -275,8 +275,8 @@ void ib_umem_odp_release(struct ib_umem_odp *umem_odp)
 		mmu_interval_notifier_remove(&umem_odp->notifier);
 		kvfree(umem_odp->dma_list);
 		kvfree(umem_odp->page_list);
-		put_pid(umem_odp->tgid);
 	}
+	put_pid(umem_odp->tgid);
 	kfree(umem_odp);
 }
 EXPORT_SYMBOL(ib_umem_odp_release);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Jason Gunthorpe

The tgid used to be part of ib_umem_free_notifier(), when it was reworked it got moved to release, but it should have been unconditional as all umem alloc paths get the tgid.

Quoted 8 lines

As is, creating an implicit ODP will leak the tgid reference.

Fixes f25a546e6529 ("RDMA/odp: Use mmu_interval_notifier_insert()")
---
 drivers/infiniband/core/umem_odp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc

Jason