Whamcloud - gitweb
LU-8022 lnet: Don't access NULL NI on failure path
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd_cb.c
index 1dbd518..4ff2e98 100644 (file)
@@ -2513,12 +2513,14 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob)
         return 0;
 
  failed:
-        if (ni != NULL)
-                lnet_ni_decref(ni);
+       if (ni != NULL) {
+               lnet_ni_decref(ni);
+               rej.ibr_cp.ibcp_queue_depth =
+                       kiblnd_msg_queue_size(version, ni);
+               rej.ibr_cp.ibcp_max_frags   = kiblnd_rdma_frags(version, ni);
+       }
 
        rej.ibr_version = version;
-       rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni);
-       rej.ibr_cp.ibcp_max_frags   = kiblnd_rdma_frags(version, ni);
        kiblnd_reject(cmid, &rej);
 
        return -ECONNREFUSED;