IB/uverbs: Improve lockdep_check
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 13 Feb 2018 10:18:38 +0000 (12:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Mar 2018 09:54:28 +0000 (10:54 +0100)
commite0486b303556ebbd03365eae88f4bb7cf1d789f6
treeb70bbff2ca98bb698f90bcfa88d73ae5d30bdf30
parentdbfed071633c27242eba0fe710d396168fd2dba7
IB/uverbs: Improve lockdep_check

commit 104f268d439b3c21c83708e52946a4d8d37f3d0f upstream.

This is really being used as an assert that the expected usecnt
is being held and implicitly that the usecnt is valid. Rename it to
assert_uverbs_usecnt and tighten the checks to only accept valid
values of usecnt (eg 0 and < -1 are invalid).

The tigher checkes make the assertion cover more cases and is more
likely to find bugs via syzkaller/etc.

Fixes: 3832125624b7 ("IB/core: Add support for idr types")
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/rdma_core.c