提交 bcb415c4 编写于 作者: N Neta Ostrovsky 提交者: Zheng Zengkai

RDMA/cma: Fix error flow in default_roce_mode_store

stable inclusion
from stable-5.10.11
commit 2cd90971a2c960c2c7a0f4e14fec8bf9c1a2e49b
bugzilla: 47621

--------------------------------

[ Upstream commit 7c7b3e5d ]

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: 1c15b4f2 ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type")
Link: https://lore.kernel.org/r/20210113130214.562108-1-leon@kernel.orgSigned-off-by: NNeta Ostrovsky <netao@nvidia.com>
Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 39f583dd
...@@ -131,8 +131,10 @@ static ssize_t default_roce_mode_store(struct config_item *item, ...@@ -131,8 +131,10 @@ static ssize_t default_roce_mode_store(struct config_item *item,
return ret; return ret;
gid_type = ib_cache_gid_parse_type_str(buf); 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; return -EINVAL;
}
ret = cma_set_default_gid_type(cma_dev, group->port_num, gid_type); ret = cma_set_default_gid_type(cma_dev, group->port_num, gid_type);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册