diff mbox series

[SRU,F,5/5] scsi: fnic: Validate io_req before others

Message ID 20220813001057.34877-6-michael.reed@canonical.com
State New
Headers show
Series fnic driver on needs to be updated to 1.6.0.53 on Focal | expand

Commit Message

Michael Reed Aug. 13, 2022, 12:10 a.m. UTC
From: Karan Tilak Kumar <kartilak@cisco.com>

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

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

Link: https://lore.kernel.org/r/20201121023337.19295-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 3256b4682386298ec106c1d1896b064f6a291f88)
Signed-off-by: Michael Reed <Michael.Reed@canonical.com>
---
 drivers/scsi/fnic/fnic.h      | 2 +-
 drivers/scsi/fnic/fnic_scsi.c | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index e4d399f41a0a..69f373b53132 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@ 
 
 #define DRV_NAME		"fnic"
 #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 DFX                     DRV_NAME "%d: "
 
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 486ff8a18a37..d2e226073d34 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1734,15 +1734,14 @@  void fnic_terminate_rport_io(struct fc_rport *rport)
 			continue;
 		}
 
-		cmd_rport = starget_to_rport(scsi_target(sc->device));
-		if (rport != cmd_rport) {
+		io_req = (struct fnic_io_req *)CMD_SP(sc);
+		if (!io_req) {
 			spin_unlock_irqrestore(io_lock, flags);
 			continue;
 		}
 
-		io_req = (struct fnic_io_req *)CMD_SP(sc);
-
-		if (!io_req || rport != cmd_rport) {
+		cmd_rport = starget_to_rport(scsi_target(sc->device));
+		if (rport != cmd_rport) {
 			spin_unlock_irqrestore(io_lock, flags);
 			continue;
 		}