summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorNeta Ostrovsky <netao@nvidia.com>2021-01-13 15:02:14 +0200
committerJason Gunthorpe <jgg@nvidia.com>2021-01-14 12:53:13 -0400
commit7c7b3e5d9aeed31d35c5dab0bf9c0fd4c8923206 (patch)
tree6597b1dbb1a82e4af39868e23fb7dc9a42a91ccf /drivers/infiniband
parent1c3aa6bd0b823105c2030af85d92d158e815d669 (diff)
downloadlinux-stable-7c7b3e5d9aeed31d35c5dab0bf9c0fd4c8923206.tar.gz
linux-stable-7c7b3e5d9aeed31d35c5dab0bf9c0fd4c8923206.tar.bz2
linux-stable-7c7b3e5d9aeed31d35c5dab0bf9c0fd4c8923206.zip
RDMA/cma: Fix error flow in default_roce_mode_store
In default_roce_mode_store(), we took a reference to cma_dev, but didn't return it with cma_dev_put in the error flow. Fixes: 1c15b4f2a42f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type") Link: https://lore.kernel.org/r/20210113130214.562108-1-leon@kernel.org Signed-off-by: Neta Ostrovsky <netao@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma_configfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 7f70e5a7de10..97a77ea8d3c9 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);