Skip to content

Commit 917cb8a

Browse files
Steve Wisejgunthorpe
authored andcommitted
RDMA/cma: Add cm_id restrack resource based on kernel or user cm_id type
A recent regression causes a null ptr crash when dumping cm_id resources. The cma is incorrectly adding all cm_id restrack resources as kernel mode. Fixes: af8d703 ("RDMA/restrack: Resource-tracker should not use uobject pointers") Signed-off-by: Steve Wise <swise@opengridcomputing.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
1 parent a9666c1 commit 917cb8a

File tree

1 file changed

+4
-1
lines changed
  • drivers/infiniband/core

1 file changed

+4
-1
lines changed

drivers/infiniband/core/cma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,10 @@ static void _cma_attach_to_dev(struct rdma_id_private *id_priv,
494494
id_priv->id.route.addr.dev_addr.transport =
495495
rdma_node_get_transport(cma_dev->device->node_type);
496496
list_add_tail(&id_priv->list, &cma_dev->id_list);
497-
rdma_restrack_kadd(&id_priv->res);
497+
if (id_priv->res.kern_name)
498+
rdma_restrack_kadd(&id_priv->res);
499+
else
500+
rdma_restrack_uadd(&id_priv->res);
498501
}
499502

500503
static void cma_attach_to_dev(struct rdma_id_private *id_priv,

0 commit comments

Comments
 (0)