* [PATCH] RDMA/cm: Fix an error check in cm_alloc_id_priv()
@ 2020-04-06 14:43 Dan Carpenter
2020-04-06 14:51 ` Jason Gunthorpe
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2020-04-06 14:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, Danit Goldberg, Parav Pandit, linux-rdma,
kernel-janitors
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: e8dc4e885c45 ("RDMA/cm: Fix ordering of xa_alloc_cyclic() in ib_create_cm_id()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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(-)
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 4794113ecd59..f7ac5974176f 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] RDMA/cm: Fix an error check in cm_alloc_id_priv()
2020-04-06 14:43 [PATCH] RDMA/cm: Fix an error check in cm_alloc_id_priv() Dan Carpenter
@ 2020-04-06 14:51 ` Jason Gunthorpe
2020-04-07 9:37 ` [PATCH v2] " Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2020-04-06 14:51 UTC (permalink / raw)
To: Dan Carpenter
Cc: Doug Ledford, Leon Romanovsky, Danit Goldberg, Parav Pandit,
linux-rdma, kernel-janitors
On Mon, Apr 06, 2020 at 05:43:35PM +0300, Dan Carpenter wrote:
> 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: e8dc4e885c45 ("RDMA/cm: Fix ordering of xa_alloc_cyclic() in ib_create_cm_id()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> 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
Fixes: ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")
Thanks,
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] RDMA/cm: Fix an error check in cm_alloc_id_priv()
2020-04-06 14:51 ` Jason Gunthorpe
@ 2020-04-07 9:37 ` Dan Carpenter
2020-04-07 16:59 ` Matthew Wilcox
2020-04-14 19:02 ` Jason Gunthorpe
0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-04-07 9:37 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, Matthew Wilcox
Cc: Leon Romanovsky, Danit Goldberg, Parav Pandit, linux-rdma,
kernel-janitors
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: ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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(-)
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 4794113ecd59..f7ac5974176f 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] RDMA/cm: Fix an error check in cm_alloc_id_priv()
2020-04-07 9:37 ` [PATCH v2] " Dan Carpenter
@ 2020-04-07 16:59 ` Matthew Wilcox
2020-04-14 19:02 ` Jason Gunthorpe
1 sibling, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2020-04-07 16:59 UTC (permalink / raw)
To: Dan Carpenter
Cc: Doug Ledford, Jason Gunthorpe, Leon Romanovsky, Danit Goldberg,
Parav Pandit, linux-rdma, kernel-janitors
On Tue, Apr 07, 2020 at 12:37:14PM +0300, Dan Carpenter wrote:
> 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: ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] RDMA/cm: Fix an error check in cm_alloc_id_priv()
2020-04-07 9:37 ` [PATCH v2] " Dan Carpenter
2020-04-07 16:59 ` Matthew Wilcox
@ 2020-04-14 19:02 ` Jason Gunthorpe
1 sibling, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2020-04-14 19:02 UTC (permalink / raw)
To: Dan Carpenter
Cc: Doug Ledford, Matthew Wilcox, Leon Romanovsky, Danit Goldberg,
Parav Pandit, linux-rdma, kernel-janitors
On Tue, Apr 07, 2020 at 12:37:14PM +0300, Dan Carpenter wrote:
> 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: ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-14 19:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 14:43 [PATCH] RDMA/cm: Fix an error check in cm_alloc_id_priv() Dan Carpenter
2020-04-06 14:51 ` Jason Gunthorpe
2020-04-07 9:37 ` [PATCH v2] " Dan Carpenter
2020-04-07 16:59 ` Matthew Wilcox
2020-04-14 19:02 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).