Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/uverbs: Fix a NULL vs IS_ERR() bug

The uapi_get_object() function returns error pointers, it never returns
NULL.

Fixes: 149d3845f4a5 ("RDMA/uverbs: Add a method to introspect handles in a context")
Link: https://lore.kernel.org/r/YJ6Got+U7lz+3n9a@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Dan Carpenter and committed by
Jason Gunthorpe
463a3f66 cfa3b797

+2 -2
+2 -2
drivers/infiniband/core/uverbs_std_types_device.c
··· 117 117 return ret; 118 118 119 119 uapi_object = uapi_get_object(attrs->ufile->device->uapi, object_id); 120 - if (!uapi_object) 121 - return -EINVAL; 120 + if (IS_ERR(uapi_object)) 121 + return PTR_ERR(uapi_object); 122 122 123 123 handles = gather_objects_handle(attrs->ufile, uapi_object, attrs, 124 124 out_len, &total);