RDMA/cm: Fix an error check in cm_alloc_id_priv()
Subsystems (2)
PATCH 1/1 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.
---
The Fixes tag may not be correct. That's the patch which introduces an Oops but we may want to backport this further back.
drivers/infiniband/core/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cm.c +1 -1
@@ -862,7 +862,7 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device, ret =xa_alloc_cyclic_irq (&cm.local_id_table, &id,NULL , xa_limit_32b, &cm.local_id_next,GFP_KERNEL ); -if (ret) +if (ret <0 ) goto error; cm_id_priv->id.local_id = (__force __be32 )id ^ cm.random_id_operand;
Signature · 1 line
2.25.1
Quoted 9 lines · Dan Carpenter
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 returnsERR_PTR(1)which will cause an Oops in the caller.Fixes e8dc4e885c45 ("RDMA/cm: Fix ordering of xa_alloc_cyclic() in ib_create_cm_id()")Signed-off-by Dan Carpenter <[email protected]>---
The Fixes tag may not be correct. That's the patch which introduces an Oops but we may want to backport this further back.
Right it should be
Thanks,
Jason
PATCH v2 1/1 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.
---
v2: Use the correct Fixes tag and add Matthew to the CC list.
drivers/infiniband/core/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cm.c +1 -1
@@ -862,7 +862,7 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device, ret =xa_alloc_cyclic_irq (&cm.local_id_table, &id,NULL , xa_limit_32b, &cm.local_id_next,GFP_KERNEL ); -if (ret) +if (ret <0 ) goto error; cm_id_priv->id.local_id = (__force __be32 )id ^ cm.random_id_operand;
Signature · 1 line
2.25.1
Quoted 6 lines · Dan Carpenter
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 returnsERR_PTR(1)which will cause an Oops in the caller.Fixes ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")Signed-off-by Dan Carpenter <[email protected]>
Jason Gunthorpe
AppliedQuoted 4 lines · Dan Carpenter
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 returnsERR_PTR(1)which will cause an Oops in the caller.
Quoted 8 lines
Fixes ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")Signed-off-by Dan Carpenter <[email protected]>Reviewed-by Matthew Wilcox (Oracle) <[email protected]>---
v2: Use the correct Fixes tag and add Matthew to the CC list.drivers/infiniband/core/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next, thanks
Jason