Skip to content

Commit 9836535

Browse files
Dan Carpenterjgunthorpe
authored andcommitted
RDMA/cm: Fix an error check in cm_alloc_id_priv()
The xa_alloc_cyclic_irq() function returns either 0 or 1 on success and negatives on error. This code treats 1 as an error and returns ERR_PTR(1) which will cause an Oops in the caller. Fixes: ae78ff3 ("RDMA/cm: Convert local_id_table to XArray") Link: https://lore.kernel.org/r/20200407093714.GA80285@mwanda Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 0c6949c commit 9836535

File tree

1 file changed

+1
-1
lines changed
  • drivers/infiniband/core

1 file changed

+1
-1
lines changed

drivers/infiniband/core/cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device,
862862

863863
ret = xa_alloc_cyclic_irq(&cm.local_id_table, &id, NULL, xa_limit_32b,
864864
&cm.local_id_next, GFP_KERNEL);
865-
if (ret)
865+
if (ret < 0)
866866
goto error;
867867
cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand;
868868

0 commit comments

Comments
 (0)