Message ID | 20190930231707.48259-11-bvanassche@acm.org (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | RDMA patches for kernel v5.5 | expand |
On Mon, Sep 30, 2019 at 04:17:02PM -0700, Bart Van Assche wrote: > 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. Did you mean it is null set for iWARP logins? I would expect iwarp to not have a pkey.. Jason
On 10/2/19 7:16 AM, Jason Gunthorpe wrote: > On Mon, Sep 30, 2019 at 04:17:02PM -0700, Bart Van Assche wrote: >> 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. > > Did you mean it is null set for iWARP logins? I would expect iwarp to > not have a pkey.. Yes, I meant that the path_rec pointer is NULL for iWARP logins. The word "NULL" should be removed from the commit message. Thanks, Bart.
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 4f99a5e040c3..fbfadeedc195 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2502,6 +2502,7 @@ static int srpt_rdma_cm_req_recv(struct rdma_cm_id *cm_id, struct srpt_device *sdev; struct srp_login_req req; const struct srp_login_req_rdma *req_rdma; + struct sa_path_rec *path_rec = cm_id->route.path_rec; char src_addr[40]; 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, &cm_id->route.addr.src_addr); 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,
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. Cc: Honggang LI <honli@redhat.com> Cc: Laurence Oberman <loberman@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)