Commit aad1271a authored by Thomas Abraham's avatar Thomas Abraham Committed by Martin K. Petersen

scsi: libfc: check fc_frame_payload_get() return value for null

We should not assume the payload of a PRLI or PLOGI respons is always
present.
Signed-off-by: default avatarThomas Abraham <tabraham@suse.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarArun Easi <arun.easi@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a33e5bfb
...@@ -1038,6 +1038,9 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -1038,6 +1038,9 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
struct fc_els_ls_rjt *rjt; struct fc_els_ls_rjt *rjt;
rjt = fc_frame_payload_get(fp, sizeof(*rjt)); rjt = fc_frame_payload_get(fp, sizeof(*rjt));
if (!rjt)
FC_RPORT_DBG(rdata, "PLOGI bad response\n");
else
FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n", FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n",
rjt->er_reason, rjt->er_explan); rjt->er_reason, rjt->er_explan);
fc_rport_error_retry(rdata, -FC_EX_ELS_RJT); fc_rport_error_retry(rdata, -FC_EX_ELS_RJT);
...@@ -1211,6 +1214,9 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -1211,6 +1214,9 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
} else { } else {
rjt = fc_frame_payload_get(fp, sizeof(*rjt)); rjt = fc_frame_payload_get(fp, sizeof(*rjt));
if (!rjt)
FC_RPORT_DBG(rdata, "PRLI bad response\n");
else
FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n", FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n",
rjt->er_reason, rjt->er_explan); rjt->er_reason, rjt->er_explan);
fc_rport_error_retry(rdata, FC_EX_ELS_RJT); fc_rport_error_retry(rdata, FC_EX_ELS_RJT);
......
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