diff options
author | Kenneth Lee <liguozhu@hisilicon.com> | 2017-01-05 02:00:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-01 02:33:12 -0500 |
commit | c81ee4ed9c0d49514254487eb037548dd5e25ef8 (patch) | |
tree | d0a0c276fbdca570bfecff0695984936a46b98c3 /drivers/infiniband | |
parent | d7c3d7e453b70e9e9e81d8409e5f8c004597ec05 (diff) |
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: 87773dd56d54 ("IB: ib_umem_release() should decrement mm->pinned_vm from ib_umem_get")
Fixes: 8ada2c1c0c1d ("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>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/umem.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 84b4eff90395..c22fde6207d1 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -134,6 +134,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, | |||
134 | IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND)); | 134 | IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND)); |
135 | 135 | ||
136 | if (access & IB_ACCESS_ON_DEMAND) { | 136 | if (access & IB_ACCESS_ON_DEMAND) { |
137 | put_pid(umem->pid); | ||
137 | ret = ib_umem_odp_get(context, umem); | 138 | ret = ib_umem_odp_get(context, umem); |
138 | if (ret) { | 139 | if (ret) { |
139 | kfree(umem); | 140 | kfree(umem); |
@@ -149,6 +150,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, | |||
149 | 150 | ||
150 | page_list = (struct page **) __get_free_page(GFP_KERNEL); | 151 | page_list = (struct page **) __get_free_page(GFP_KERNEL); |
151 | if (!page_list) { | 152 | if (!page_list) { |
153 | put_pid(umem->pid); | ||
152 | kfree(umem); | 154 | kfree(umem); |
153 | return ERR_PTR(-ENOMEM); | 155 | return ERR_PTR(-ENOMEM); |
154 | } | 156 | } |