RDMA/cm: Respect returned status of cm_init_av_by_path
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 11 Oct 2018 19:36:10 +0000 (22:36 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 16 Oct 2018 14:29:24 +0000 (08:29 -0600)
Add missing check for failure of cm_init_av_by_path

Fixes: e1444b5a163e ("IB/cm: Fix automatic path migration support")
Reported-by: Slava Shwartsman <slavash@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cm.c

index a6a20603ccea5192d9e4648bcda303d062110b5b..edb2cb758be729a4f6ac65ca5a211452726f87d6 100644 (file)
@@ -3292,8 +3292,11 @@ static int cm_lap_handler(struct cm_work *work)
        if (ret)
                goto unlock;
 
-       cm_init_av_by_path(param->alternate_path, NULL, &cm_id_priv->alt_av,
-                          cm_id_priv);
+       ret = cm_init_av_by_path(param->alternate_path, NULL,
+                                &cm_id_priv->alt_av, cm_id_priv);
+       if (ret)
+               goto unlock;
+
        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);