]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject()
authorMaher Sanalla <msanalla@nvidia.com>
Wed, 26 Feb 2025 13:54:13 +0000 (15:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:12:44 +0000 (11:12 +0200)
commit1d5b8897e34ea7e427b56bfbcef347b49d991ef8
tree319238a760c6fa5d74ece7e98998179f40702425
parent0b9fb04e2614c627e73d0b5d65075bdcaa5a97d8
RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject()

[ Upstream commit 81f8f7454ad9e0bf95efdec6542afdc9a6ab1e24 ]

Currently, the IB uverbs API calls uobj_get_uobj_read(), which in turn
uses the rdma_lookup_get_uobject() helper to retrieve user objects.
In case of failure, uobj_get_uobj_read() returns NULL, overriding the
error code from rdma_lookup_get_uobject(). The IB uverbs API then
translates this NULL to -EINVAL, masking the actual error and
complicating debugging. For example, applications calling ibv_modify_qp
that fails with EBUSY when retrieving the QP uobject will see the
overridden error code EINVAL instead, masking the actual error.

Furthermore, based on rdma-core commit:
"2a22f1ced5f3 ("Merge pull request #1568 from jakemoroni/master")"
Kernel's IB uverbs return values are either ignored and passed on as is
to application or overridden with other errnos in a few cases.

Thus, to improve error reporting and debuggability, propagate the
original error from rdma_lookup_get_uobject() instead of replacing it
with EINVAL.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Link: https://patch.msgid.link/64f9d3711b183984e939962c2f83383904f97dfb.1740577869.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/uverbs_cmd.c
include/rdma/uverbs_std_types.h