From: Jason Gunthorpe Date: Thu, 14 Feb 2019 20:13:31 +0000 (+0000) Subject: RDMA/uverbs: Fix an error flow in ib_uverbs_poll_cq X-Git-Tag: v5.1-rc1~86^2~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a7786784dcbec2f6ad52fd98a8d076f808e59f2;p=thirdparty%2Fkernel%2Flinux.git RDMA/uverbs: Fix an error flow in ib_uverbs_poll_cq The new output_written block was wrongly placed before the ret=0, causing the error code to be lost. uverbs_output_written is not expected to fail, and even if it does fail it has no significant impact on the userspace flow. Reported-by: Bart Van Assche Fixes: d6f4a21f309d ("RDMA/uverbs: Mark ioctl responses with UVERBS_ATTR_F_VALID_OUTPUT") Signed-off-by: Jason Gunthorpe Reviewed-by: Leon Romanovsky --- diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index c2e7733a7fe07..4947d1480c6d2 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -1186,12 +1186,11 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs) ret = -EFAULT; goto out_put; } + ret = 0; if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) ret = uverbs_output_written(attrs, UVERBS_ATTR_CORE_OUT); - ret = 0; - out_put: uobj_put_obj_read(cq); return ret;