]> git.baikalelectronics.ru Git - kernel.git/commit
IB/umem: Use the correct mm during ib_umem_release
authorLidong Chen <jemmy858585@gmail.com>
Tue, 8 May 2018 08:50:16 +0000 (16:50 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 15 May 2018 23:09:10 +0000 (17:09 -0600)
commitc651eb0b4aa16db72fe9a2a2252edf8fa043b168
tree5ce4bf10cbe8129f41020043768d3958eebb2eff
parentbf310f49b17516b1534938bd4fa82fa14f55d30e
IB/umem: Use the correct mm during ib_umem_release

User-space may invoke ibv_reg_mr and ibv_dereg_mr in different threads.

If ibv_dereg_mr is called after the thread which invoked ibv_reg_mr has
exited, get_pid_task will return NULL and ib_umem_release will not
decrease mm->pinned_vm.

Instead of using threads to locate the mm, use the overall tgid from the
ib_ucontext struct instead. This matches the behavior of ODP and
disassociate in handling the mm of the process that called ibv_reg_mr.

Cc: <stable@vger.kernel.org>
Fixes: a88cb8d3789f ("IB: ib_umem_release() should decrement mm->pinned_vm from ib_umem_get")
Signed-off-by: Lidong Chen <lidongchen@tencent.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/umem.c
include/rdma/ib_umem.h