Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH rdma-next] RDMA/cma: Fix error flow in default_roce_mode_store
@ 2021-01-13 13:02 Leon Romanovsky
  2021-01-14 17:06 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2021-01-13 13:02 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe; +Cc: Neta Ostrovsky, Avihai Horon, linux-rdma

From: Neta Ostrovsky <netao@nvidia.com>

In default_roce_mode_store(), we took a reference to cma_dev, but
didn't return it in error flow. Fix it by calling to cma_dev_put
in such flow.

Fixes: 1c15b4f2a42f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type")
Signed-off-by: Neta Ostrovsky <netao@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/core/cma_configfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 9fa1653fb7b7..e0d5e3bae458 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -131,8 +131,10 @@ static ssize_t default_roce_mode_store(struct config_item *item,
 		return ret;
 
 	gid_type = ib_cache_gid_parse_type_str(buf);
-	if (gid_type < 0)
+	if (gid_type < 0) {
+		cma_configfs_params_put(cma_dev);
 		return -EINVAL;
+	}
 
 	ret = cma_set_default_gid_type(cma_dev, group->port_num, gid_type);
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH rdma-next] RDMA/cma: Fix error flow in default_roce_mode_store
  2021-01-13 13:02 [PATCH rdma-next] RDMA/cma: Fix error flow in default_roce_mode_store Leon Romanovsky
@ 2021-01-14 17:06 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-01-14 17:06 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Doug Ledford, Neta Ostrovsky, Avihai Horon, linux-rdma

On Wed, Jan 13, 2021 at 03:02:14PM +0200, Leon Romanovsky wrote:
> From: Neta Ostrovsky <netao@nvidia.com>
> 
> In default_roce_mode_store(), we took a reference to cma_dev, but
> didn't return it in error flow. Fix it by calling to cma_dev_put
> in such flow.
> 
> Fixes: 1c15b4f2a42f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type")
> Signed-off-by: Neta Ostrovsky <netao@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/cma_configfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to for-rc

Thanks,
Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-14 17:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-13 13:02 [PATCH rdma-next] RDMA/cma: Fix error flow in default_roce_mode_store Leon Romanovsky
2021-01-14 17:06 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox