Skip to content

Commit

Permalink
IB/umem: Release pid in error and ODP flow
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Haggai Eran <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
Kenneth Lee authored and dledford committed Jan 24, 2017
1 parent f449c7a commit 828f6fa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/infiniband/core/umem.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND));

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

page_list = (struct page **) __get_free_page(GFP_KERNEL);
if (!page_list) {
put_pid(umem->pid);
kfree(umem);
return ERR_PTR(-ENOMEM);
}
Expand Down

0 comments on commit 828f6fa

Please sign in to comment.