Commit 3256b468 authored by Karan Tilak Kumar's avatar Karan Tilak Kumar Committed by Martin K. Petersen

scsi: fnic: Validate io_req before others

We need to check for a valid io_req before we check other data. Also,
remove redundant checks.

Link: https://lore.kernel.org/r/20201121023337.19295-1-kartilak@cisco.comReviewed-by: default avatarArulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarKaran Tilak Kumar <kartilak@cisco.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 74ae6d6a
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define DRV_NAME "fnic" #define DRV_NAME "fnic"
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
#define DRV_VERSION "1.6.0.52" #define DRV_VERSION "1.6.0.53"
#define PFX DRV_NAME ": " #define PFX DRV_NAME ": "
#define DFX DRV_NAME "%d: " #define DFX DRV_NAME "%d: "
......
...@@ -1735,15 +1735,14 @@ void fnic_terminate_rport_io(struct fc_rport *rport) ...@@ -1735,15 +1735,14 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
continue; continue;
} }
cmd_rport = starget_to_rport(scsi_target(sc->device)); io_req = (struct fnic_io_req *)CMD_SP(sc);
if (rport != cmd_rport) { if (!io_req) {
spin_unlock_irqrestore(io_lock, flags); spin_unlock_irqrestore(io_lock, flags);
continue; continue;
} }
io_req = (struct fnic_io_req *)CMD_SP(sc); cmd_rport = starget_to_rport(scsi_target(sc->device));
if (rport != cmd_rport) {
if (!io_req || rport != cmd_rport) {
spin_unlock_irqrestore(io_lock, flags); spin_unlock_irqrestore(io_lock, flags);
continue; continue;
} }
......
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