Commit cbca2442 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jason Gunthorpe

RDMA/srpt: Fix handling of iWARP logins

The path_rec pointer is NULL set for IB and RoCE logins but not for iWARP
logins. Hence check the path_rec pointer before dereferencing it.

Link: https://lore.kernel.org/r/20190930231707.48259-11-bvanassche@acm.org
Cc: Honggang LI <honli@redhat.com>
Cc: Laurence Oberman <loberman@redhat.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 09f8a148
...@@ -2502,6 +2502,7 @@ static int srpt_rdma_cm_req_recv(struct rdma_cm_id *cm_id, ...@@ -2502,6 +2502,7 @@ static int srpt_rdma_cm_req_recv(struct rdma_cm_id *cm_id,
struct srpt_device *sdev; struct srpt_device *sdev;
struct srp_login_req req; struct srp_login_req req;
const struct srp_login_req_rdma *req_rdma; const struct srp_login_req_rdma *req_rdma;
struct sa_path_rec *path_rec = cm_id->route.path_rec;
char src_addr[40]; char src_addr[40];
sdev = ib_get_client_data(cm_id->device, &srpt_client); sdev = ib_get_client_data(cm_id->device, &srpt_client);
...@@ -2527,7 +2528,7 @@ static int srpt_rdma_cm_req_recv(struct rdma_cm_id *cm_id, ...@@ -2527,7 +2528,7 @@ static int srpt_rdma_cm_req_recv(struct rdma_cm_id *cm_id,
&cm_id->route.addr.src_addr); &cm_id->route.addr.src_addr);
return srpt_cm_req_recv(sdev, NULL, cm_id, cm_id->port_num, return srpt_cm_req_recv(sdev, NULL, cm_id, cm_id->port_num,
cm_id->route.path_rec->pkey, &req, src_addr); path_rec ? path_rec->pkey : 0, &req, src_addr);
} }
static void srpt_cm_rej_recv(struct srpt_rdma_ch *ch, static void srpt_cm_rej_recv(struct srpt_rdma_ch *ch,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment