提交 925f7ea7 编写于 作者: L Leon Romanovsky 提交者: Jason Gunthorpe

RDMA/cm: Fix access to uninitialized variable

The ndev will be initialized and held only for successful
ib_get_cached_gid(), otherwise it is garbage stack memory.
Calling dev_put() in failure path is wrong.

Fixes: 16c72e40 ("IB/cm: Refactor to avoid setting path record software only fields")
Signed-off-by: NParav Pandit <parav@mellanox.com>
Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: NYuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 3cd96fdd
......@@ -1901,8 +1901,6 @@ static int cm_req_handler(struct cm_work *work)
grh->sgid_index,
&gid, &gid_attr);
if (ret) {
if (gid_attr.ndev)
dev_put(gid_attr.ndev);
ib_send_cm_rej(cm_id, IB_CM_REJ_UNSUPPORTED, NULL, 0, NULL, 0);
goto rejected;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册