linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: fnic: Validate io_req before others
@ 2020-11-21  2:33 Karan Tilak Kumar
  2020-11-24  1:32 ` Arulprabhu Ponnusamy (arulponn)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Karan Tilak Kumar @ 2020-11-21  2:33 UTC (permalink / raw)
  To: satishkh
  Cc: sebaddel, arulponn, jejb, martin.petersen, linux-scsi,
	linux-kernel, Karan Tilak Kumar

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

Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
---
 drivers/scsi/fnic/fnic.h      | 2 +-
 drivers/scsi/fnic/fnic_scsi.c | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

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 532c3c7ae372..36744968378f 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1735,15 +1735,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;
 		}
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: fnic: Validate io_req before others
  2020-11-21  2:33 [PATCH] scsi: fnic: Validate io_req before others Karan Tilak Kumar
@ 2020-11-24  1:32 ` Arulprabhu Ponnusamy (arulponn)
  2020-11-24  3:48 ` Martin K. Petersen
  2020-12-01  5:04 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Arulprabhu Ponnusamy (arulponn) @ 2020-11-24  1:32 UTC (permalink / raw)
  To: Karan Tilak Kumar (kartilak), Satish Kharat (satishkh)
  Cc: Sesidhar Baddela (sebaddel),
	jejb, martin.petersen, linux-scsi, linux-kernel

Looks good.
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>

On 11/20/20, 6:33 PM, "Karan Tilak Kumar" <kartilak@cisco.com> wrote:

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

    Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
    Signed-off-by: Satish Kharat <satishkh@cisco.com>
    ---
     drivers/scsi/fnic/fnic.h      | 2 +-
     drivers/scsi/fnic/fnic_scsi.c | 9 ++++-----
     2 files changed, 5 insertions(+), 6 deletions(-)

    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 532c3c7ae372..36744968378f 100644
    --- a/drivers/scsi/fnic/fnic_scsi.c
    +++ b/drivers/scsi/fnic/fnic_scsi.c
    @@ -1735,15 +1735,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;
     		}
    -- 
    2.29.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: fnic: Validate io_req before others
  2020-11-21  2:33 [PATCH] scsi: fnic: Validate io_req before others Karan Tilak Kumar
  2020-11-24  1:32 ` Arulprabhu Ponnusamy (arulponn)
@ 2020-11-24  3:48 ` Martin K. Petersen
  2020-12-01  5:04 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-11-24  3:48 UTC (permalink / raw)
  To: Karan Tilak Kumar
  Cc: satishkh, sebaddel, arulponn, jejb, martin.petersen, linux-scsi,
	linux-kernel


Karan,

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

Applied to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: fnic: Validate io_req before others
  2020-11-21  2:33 [PATCH] scsi: fnic: Validate io_req before others Karan Tilak Kumar
  2020-11-24  1:32 ` Arulprabhu Ponnusamy (arulponn)
  2020-11-24  3:48 ` Martin K. Petersen
@ 2020-12-01  5:04 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-12-01  5:04 UTC (permalink / raw)
  To: satishkh, Karan Tilak Kumar
  Cc: Martin K . Petersen, jejb, arulponn, linux-kernel, sebaddel, linux-scsi

On Fri, 20 Nov 2020 18:33:37 -0800, Karan Tilak Kumar wrote:

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

Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: fnic: Validate io_req before others
      https://git.kernel.org/mkp/scsi/c/3256b4682386

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-01  5:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21  2:33 [PATCH] scsi: fnic: Validate io_req before others Karan Tilak Kumar
2020-11-24  1:32 ` Arulprabhu Ponnusamy (arulponn)
2020-11-24  3:48 ` Martin K. Petersen
2020-12-01  5:04 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).