IB/uverbs: Always propagate errors from rdma_alloc_commit_uobject()

The ioctl framework already does this correctly, but the write path did
not. This is trivially fixed by simply using a standard pattern to return
uobj_alloc_commit() as the last statement in every function.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Jason Gunthorpe
2018-07-10 20:55:20 -06:00
parent e951747a08
commit 2c96eb7d62
4 changed files with 26 additions and 39 deletions

View File

@@ -102,9 +102,14 @@ static inline int __must_check uobj_remove_commit(struct ib_uobject *uobj)
return rdma_remove_commit_uobject(uobj);
}
static inline void uobj_alloc_commit(struct ib_uobject *uobj)
static inline int __must_check uobj_alloc_commit(struct ib_uobject *uobj,
int success_res)
{
rdma_alloc_commit_uobject(uobj);
int ret = rdma_alloc_commit_uobject(uobj);
if (ret)
return ret;
return success_res;
}
static inline void uobj_alloc_abort(struct ib_uobject *uobj)

View File

@@ -127,7 +127,7 @@ struct ib_uobject *rdma_alloc_begin_uobject(const struct uverbs_obj_type *type,
struct ib_uverbs_file *ufile);
void rdma_alloc_abort_uobject(struct ib_uobject *uobj);
int __must_check rdma_remove_commit_uobject(struct ib_uobject *uobj);
int rdma_alloc_commit_uobject(struct ib_uobject *uobj);
int __must_check rdma_alloc_commit_uobject(struct ib_uobject *uobj);
int rdma_explicit_destroy(struct ib_uobject *uobject);
struct uverbs_obj_fd_type {