From patchwork Sat Aug 13 00:10:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Reed X-Patchwork-Id: 1666025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=WlSF/hLA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4LYh1j5wz9sGq for ; Sat, 13 Aug 2022 10:11:18 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oMekA-0007NC-1u; Sat, 13 Aug 2022 00:11:10 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oMek7-0007LO-Qm for kernel-team@lists.ubuntu.com; Sat, 13 Aug 2022 00:11:07 +0000 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B51BF3F0E1 for ; Sat, 13 Aug 2022 00:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660349466; bh=uK8nOTFOvPnCT01cz3AO4go+AWmc4oUhYNoYCKeWYgg=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WlSF/hLAkU2tq5NllCTzN9AVYIYtGxeYRnUdRwySI25WBG/xJZuT7yUhzRm+UAGEN xSu+wcjHXcXYXdhLf/Z2p2yyolLOu9aLrR3g8lIdJXaHs9JgALIMgWa8nliqJOip0V wQNCFov69o20BjeE8XW2Kj4c+8UjCLy96Co/wTuC34POUAIhsA+GPTFlTvSVGvlFnT wnL/MUFQlSAvlJgjDL5sFI2d33kgVc8ji8Yny7MfX8lnSEYeFqtihm3ax/l5zHAeqc JEMstD3kMuT3u1SIdP7XESrPgObsoBjCsg0LSSmGml+Jf+o97KB4uRQW4+vUauW/Ra Dzw+hFdU3VjHg== Received: by mail-ot1-f71.google.com with SMTP id f3-20020a9d2c03000000b00636969b5938so823460otb.6 for ; Fri, 12 Aug 2022 17:11:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=uK8nOTFOvPnCT01cz3AO4go+AWmc4oUhYNoYCKeWYgg=; b=fvqaTzENOsmdzmG0XkpFvjuEUclMmAbr/UzVyadU8XcG2cONR+slYnpE19bL+DkX48 j81Bhawj6f4bdd5PbZzj+C+m5WxcMg1DneYxpUVXctByPz7McCYJd+lvTlW9KO0nIQmk MRynmyZG2q6jgyOoHOci0NR5sUXmNt/XerYHXc7ArTUHbAOiTHC91HQAcK3SPL3ZEA0l 0qM3MLA2DBjmHl2AQnXlWIKfud4sulEuKHS3SW6G3D/ge9rMX/w4cDwfzLSfVTCECQR7 rebQntvQvYhIaBGn1xXmkv2MEFRfeiSENeRQ3g2AhFDWdlfbZcg+kEG1pcmjNBaRfZ6T is7Q== X-Gm-Message-State: ACgBeo2L28cu4k3QkIqkbwP7BWci8xUW2Rg+ytZFkzcIyIg04zxcT+y1 ngOKZqIYzaGEZEMkM3XyO5VH0tvfuJV61R7iKZGqS//32jVwx2NtPMw1jIGzwIlV7JCGi/ooYyK 1ybGDIabXZdFGpvb70d21L4qwSZE6yC6Vk3lq6Whg7A== X-Received: by 2002:a05:6870:3485:b0:101:b3b1:ff4d with SMTP id n5-20020a056870348500b00101b3b1ff4dmr6832600oah.95.1660349465260; Fri, 12 Aug 2022 17:11:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR4MJitLG1YH9akpWwzMO4b9kymxTIiXHltZUpyHJ7vq4kymJSRKxRYdr/nj2MD1+2SGMECjdQ== X-Received: by 2002:a05:6870:3485:b0:101:b3b1:ff4d with SMTP id n5-20020a056870348500b00101b3b1ff4dmr6832596oah.95.1660349465022; Fri, 12 Aug 2022 17:11:05 -0700 (PDT) Received: from localhost ([2600:1700:1d0:5e50:51b0:150c:5b8d:e224]) by smtp.gmail.com with ESMTPSA id m12-20020a056870560c00b000f32fb9d2bfsm201533oao.5.2022.08.12.17.11.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 17:11:04 -0700 (PDT) From: Michael Reed To: kernel-team@lists.ubuntu.com Subject: [SRU][F][PATCH 5/5] scsi: fnic: Validate io_req before others Date: Fri, 12 Aug 2022 19:10:57 -0500 Message-Id: <20220813001057.34877-6-michael.reed@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220813001057.34877-1-michael.reed@canonical.com> References: <20220813001057.34877-1-michael.reed@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Karan Tilak Kumar 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 Co-developed-by: Satish Kharat Signed-off-by: Satish Kharat Signed-off-by: Karan Tilak Kumar Signed-off-by: Martin K. Petersen (cherry picked from commit 3256b4682386298ec106c1d1896b064f6a291f88) Signed-off-by: Michael Reed --- 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 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; }