]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: qla2xxx: Fix NULL pointer access for fcport structure
authorQuinn Tran <quinn.tran@cavium.com>
Thu, 28 Dec 2017 20:33:09 +0000 (12:33 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Jan 2018 04:41:04 +0000 (23:41 -0500)
when processing iocb in a timeout case, driver was trying to log messages
without verifying if the fcport structure could have valid data. This
results in a NULL pointer access.

Fixes: 726b85487067("qla2xxx: Add framework for async fabric discovery")
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_init.c

index 58663df38627a654be9a6f281557e629924352de..b650ebec1b9d28d4edbf8a983787e81a913356f5 100644 (file)
@@ -102,11 +102,16 @@ qla2x00_async_iocb_timeout(void *data)
        struct srb_iocb *lio = &sp->u.iocb_cmd;
        struct event_arg ea;
 
-       ql_dbg(ql_dbg_disc, fcport->vha, 0x2071,
-           "Async-%s timeout - hdl=%x portid=%06x %8phC.\n",
-           sp->name, sp->handle, fcport->d_id.b24, fcport->port_name);
+       if (fcport) {
+               ql_dbg(ql_dbg_disc, fcport->vha, 0x2071,
+                   "Async-%s timeout - hdl=%x portid=%06x %8phC.\n",
+                   sp->name, sp->handle, fcport->d_id.b24, fcport->port_name);
 
-       fcport->flags &= ~FCF_ASYNC_SENT;
+               fcport->flags &= ~FCF_ASYNC_SENT;
+       } else {
+               pr_info("Async-%s timeout - hdl=%x.\n",
+                   sp->name, sp->handle);
+       }
 
        switch (sp->type) {
        case SRB_LOGIN_CMD: