Commit 63a3345c authored by Maor Gottlieb's avatar Maor Gottlieb Committed by Jason Gunthorpe

IB/cma: Fix ports memory leak in cma_configfs

The allocated ports structure in never freed. The free function should be
called by release_cma_ports_group, but the group is never released since
we don't remove its default group.

Remove default groups when device group is deleted.

Fixes: 045959db ("IB/cma: Add configfs for rdma_cm")
Link: https://lore.kernel.org/r/20200521072650.567908-1-leon@kernel.orgSigned-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 47393fb5
...@@ -322,8 +322,21 @@ static struct config_group *make_cma_dev(struct config_group *group, ...@@ -322,8 +322,21 @@ static struct config_group *make_cma_dev(struct config_group *group,
return ERR_PTR(err); return ERR_PTR(err);
} }
static void drop_cma_dev(struct config_group *cgroup, struct config_item *item)
{
struct config_group *group =
container_of(item, struct config_group, cg_item);
struct cma_dev_group *cma_dev_group =
container_of(group, struct cma_dev_group, device_group);
configfs_remove_default_groups(&cma_dev_group->ports_group);
configfs_remove_default_groups(&cma_dev_group->device_group);
config_item_put(item);
}
static struct configfs_group_operations cma_subsys_group_ops = { static struct configfs_group_operations cma_subsys_group_ops = {
.make_group = make_cma_dev, .make_group = make_cma_dev,
.drop_item = drop_cma_dev,
}; };
static const struct config_item_type cma_subsys_type = { static const struct config_item_type cma_subsys_type = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment