From 2c96eb7d62de5048aa08e9ee4fbb607f29e2638c Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Tue, 10 Jul 2018 20:55:20 -0600 Subject: 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 --- include/rdma/uverbs_std_types.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/rdma/uverbs_std_types.h') diff --git a/include/rdma/uverbs_std_types.h b/include/rdma/uverbs_std_types.h index 4f32eab8b7a4..076f085d2dcf 100644 --- a/include/rdma/uverbs_std_types.h +++ b/include/rdma/uverbs_std_types.h @@ -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) -- cgit