IB/uverbs: Fix unbalanced unlock on error path for rdma_explicit_destroy
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 13 Feb 2018 10:18:40 +0000 (12:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:51:56 +0000 (07:51 +0200)
commit357b528e6b701314c34f10afa34a408c4eca0f65
tree1a36ed55cec4bf513fcabcf2b739476869a187aa
parent5b0622bfe6371b132a4e54d1cb2e7534386fa801
IB/uverbs: Fix unbalanced unlock on error path for rdma_explicit_destroy

[ Upstream commit ec6f8401c48a86809237e86878a6fac6b281118f ]

If remove_commit fails then the lock is left locked while the uobj still
exists. Eventually the kernel will deadlock.

lockdep detects this and says:

 test/4221 is leaving the kernel with locks still held!
 1 lock held by test/4221:
  #0:  (&ucontext->cleanup_rwsem){.+.+}, at: [<000000001e5c7523>] rdma_explicit_destroy+0x37/0x120 [ib_uverbs]

Fixes: 4da70da23e9b ("IB/core: Explicitly destroy an object while keeping uobject")
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/rdma_core.c