Skip to content

Commit

Permalink
RDMA/cm: Fix access to uninitialized variable
Browse files Browse the repository at this point in the history
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: 16c72e4 ("IB/cm: Refactor to avoid setting path record software only fields")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Leon Romanovsky authored and Jason Gunthorpe committed Jan 28, 2018
1 parent 3cd96fd commit 925f7ea
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 925f7ea

Please sign in to comment.