提交 a5c57d32 编写于 作者: P Parav Pandit 提交者: Jason Gunthorpe

IB/cm: Avoid AV ah_attr overwriting during LAP message handling

AH attribute of the cm_id can be overwritten if LAP message is received
on CM request which is in progress. This bug got introduced to avoid
sleeping when spin lock is held as part of commit in Fixes tag.

Therefore validate the cm_id state first and continue to perform AV
ah_attr initialization.

Given that Aleternative path related messages are not supported for
RoCE, init_av_from_response/path is such messages are ok to be called
from blocking context.

Fixes: 33f93e1e ("IB/cm: Fix sleeping while spin lock is held")
Signed-off-by: NParav Pandit <parav@mellanox.com>
Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 f43c00c0
...@@ -3189,12 +3189,6 @@ static int cm_lap_handler(struct cm_work *work) ...@@ -3189,12 +3189,6 @@ static int cm_lap_handler(struct cm_work *work)
if (!cm_id_priv) if (!cm_id_priv)
return -EINVAL; return -EINVAL;
ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
work->mad_recv_wc->recv_buf.grh,
&cm_id_priv->av);
if (ret)
goto deref;
param = &work->cm_event.param.lap_rcvd; param = &work->cm_event.param.lap_rcvd;
memset(&work->path[0], 0, sizeof(work->path[1])); memset(&work->path[0], 0, sizeof(work->path[1]));
cm_path_set_rec_type(work->port->cm_dev->ib_device, cm_path_set_rec_type(work->port->cm_dev->ib_device,
...@@ -3239,10 +3233,16 @@ static int cm_lap_handler(struct cm_work *work) ...@@ -3239,10 +3233,16 @@ static int cm_lap_handler(struct cm_work *work)
goto unlock; goto unlock;
} }
cm_id_priv->id.lap_state = IB_CM_LAP_RCVD; ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
cm_id_priv->tid = lap_msg->hdr.tid; work->mad_recv_wc->recv_buf.grh,
&cm_id_priv->av);
if (ret)
goto unlock;
cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av, cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av,
cm_id_priv); cm_id_priv);
cm_id_priv->id.lap_state = IB_CM_LAP_RCVD;
cm_id_priv->tid = lap_msg->hdr.tid;
ret = atomic_inc_and_test(&cm_id_priv->work_count); ret = atomic_inc_and_test(&cm_id_priv->work_count);
if (!ret) if (!ret)
list_add_tail(&work->list, &cm_id_priv->work_list); list_add_tail(&work->list, &cm_id_priv->work_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册