Skip to content

Commit 5288474

Browse files
Kenneth Leegregkh
authored andcommitted
IB/umem: Release pid in error and ODP flow
commit 828f6fa65ce7e80f77f5ab12942e44eb3d9d174e upstream. 1. Release pid before enter odp flow 2. Release pid when fail to allocate memory Fixes: 87773dd ("IB: ib_umem_release() should decrement mm->pinned_vm from ib_umem_get") Fixes: 8ada2c1 ("IB/core: Add support for on demand paging regions") Signed-off-by: Kenneth Lee <liguozhu@hisilicon.com> Reviewed-by: Haggai Eran <haggaie@mellanox.com> Reviewed-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e114e66 commit 5288474

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/infiniband/core/umem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
134134
IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND));
135135

136136
if (access & IB_ACCESS_ON_DEMAND) {
137+
put_pid(umem->pid);
137138
ret = ib_umem_odp_get(context, umem);
138139
if (ret) {
139140
kfree(umem);
@@ -149,6 +150,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
149150

150151
page_list = (struct page **) __get_free_page(GFP_KERNEL);
151152
if (!page_list) {
153+
put_pid(umem->pid);
152154
kfree(umem);
153155
return ERR_PTR(-ENOMEM);
154156
}

0 commit comments

Comments
 (0)