Skip to content

Commit 7c7b3e5

Browse files
NetaOstrovskyjgunthorpe
authored andcommitted
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: 1c15b4f ("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>
1 parent 1c3aa6b commit 7c7b3e5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/infiniband/core/cma_configfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ static ssize_t default_roce_mode_store(struct config_item *item,
131131
return ret;
132132

133133
gid_type = ib_cache_gid_parse_type_str(buf);
134-
if (gid_type < 0)
134+
if (gid_type < 0) {
135+
cma_configfs_params_put(cma_dev);
135136
return -EINVAL;
137+
}
136138

137139
ret = cma_set_default_gid_type(cma_dev, group->port_num, gid_type);
138140

0 commit comments

Comments
 (0)