Commit 9928812c authored by Colin Ian King's avatar Colin Ian King Committed by Kleber Sacilotto de Souza

scsi: libfc: fix null pointer dereference on a null lport

BugLink: https://bugs.launchpad.net/bugs/1864773

[ Upstream commit 41a6bf65 ]

Currently if lport is null then the null lport pointer is dereference when
printing out debug via the FC_LPORT_DB macro. Fix this by using the more
generic FC_LIBFC_DBG debug macro instead that does not use lport.

Addresses-Coverity: ("Dereference after null check")
Fixes: 7414705e ("libfc: Add runtime debugging with debug_logging module parameter")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 1ecf59f1
...@@ -2499,7 +2499,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) ...@@ -2499,7 +2499,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
/* lport lock ? */ /* lport lock ? */
if (!lport || lport->state == LPORT_ST_DISABLED) { if (!lport || lport->state == LPORT_ST_DISABLED) {
FC_LPORT_DBG(lport, "Receiving frames for an lport that " FC_LIBFC_DBG("Receiving frames for an lport that "
"has not been initialized correctly\n"); "has not been initialized correctly\n");
fc_frame_free(fp); fc_frame_free(fp);
return; return;
......
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