Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp346180ybt; Wed, 24 Jun 2020 00:19:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqLKQNwBS8D2jty7by2FIbH/TpJxU31nre49H/cgd5iGC6MvS10IQckLJENRSW1tGty7Sr X-Received: by 2002:aa7:d650:: with SMTP id v16mr16625679edr.361.1592983165727; Wed, 24 Jun 2020 00:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592983165; cv=none; d=google.com; s=arc-20160816; b=vRxGOlnST8+PGe/wWiKHJbY1z6Ck4Dbo/oBMkIxNqynqpMVZgfdDDhi3rc6hKFZw7Z csJCCwr//Wa8+3vjFTAFHiowvrB5dnI3O7RSPLZBb6Ncwn9SfRabg9k2xhOtpKht7Sh6 B/1y9ZiUKS0TEvfA3S9xZMKddZ7RPLuT2iwHK7RwFBoFYp5zyZKp+un8KcNW1OkkrGUK J7zPp5xN0obY04nzNZSEqgF77u9ic5vKsV0yXxeYXzKRPrugop5Vl0wBdARyoJbg83KN RCoMDRAPVfrMXzjN+pW+NrZ10OhEnCIyTW+F4ca7SBHaMs0pK8u5RgOerzOCu/c8DwhZ khNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=T/RrPEOuZL0V8yVDfilBQLhHwRf2AVG5WsrPELty+0I=; b=ddNXa9BNQPZ7faPw1jnKSP6mUQA7diT6YIBCEpm0MN9eSKdsV8J/YD1gZIWQ5WoluX qY8MWf3M82N9UOvkp7EsXLUuhDvcdqHfxQVC9zQm1wWEQbgztGeUjGoHR2w57ZOqg+xT OWkHu5bOtSQeYBaNZPTroWd84uxHVLp8Q9DRNEJBZBWWd2bV1yk+b1NQSDEaYMk2dLDb 0jm81FKvwWzysjxDGo2kqdDbin2wZP6HCyKEOKxmzSwOx1eYBj2zHR0I2K9GbfAtmJza vS+QCmfvb4JhFANYpkdzVasqFeGHOiu6VJboaBP4jEZTPJ3uzXIhlKrQMPKHFT0q7KYC n+eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=TjhvBKvD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o27si13898372edz.331.2020.06.24.00.19.02; Wed, 24 Jun 2020 00:19:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=TjhvBKvD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389639AbgFXHRx (ORCPT + 99 others); Wed, 24 Jun 2020 03:17:53 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:19320 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728360AbgFXHRx (ORCPT ); Wed, 24 Jun 2020 03:17:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1592983072; x=1624519072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=T/RrPEOuZL0V8yVDfilBQLhHwRf2AVG5WsrPELty+0I=; b=TjhvBKvDhOwWnJl82T+m1TyWW06YkeBgQeHvy2n9vyuVmgHF59QBLp1j xqyZk5bsDoqMA3hB3Tt4WPtlFxK66tgrYScN2n0fYBfD4bSWpHiDulPR5 jym9scerHLFH3mMOpuhtYNujpZfIOOFy0KrHUg4wwNbMD+iydVvpd7two g=; IronPort-SDR: iMaIzfj6jPUVra8XiwdW7DyCYPXmIV7gxqkQgarHk/ZGbURi2LzKfFhfWMMVt/DurLztiJj/ZR X/rnfPwRMEjQ== X-IronPort-AV: E=Sophos;i="5.75,274,1589241600"; d="scan'208";a="46485639" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1e-17c49630.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 24 Jun 2020 07:17:35 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-17c49630.us-east-1.amazon.com (Postfix) with ESMTPS id 72A9AA0561; Wed, 24 Jun 2020 07:17:33 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 07:17:32 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.180) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 07:17:29 +0000 From: SeongJae Park To: CC: , , , SeongJae Park Subject: [PATCH v2] scsi: lpfc: Avoid another null dereference in lpfc_sli4_hba_unset() Date: Wed, 24 Jun 2020 09:17:04 +0200 Message-ID: <20200624071704.20408-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200624071447.19529-1-sjpark@amazon.com> References: <20200624071447.19529-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.180] X-ClientProxiedBy: EX13D07UWA001.ant.amazon.com (10.43.160.145) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park Commit cdb42becdd40 ("scsi: lpfc: Replace io_channels for nvme and fcp with general hdw_queues per cpu") has introduced static checker warnings for potential null dereferences in 'lpfc_sli4_hba_unset()' and commit 1ffdd2c0440d ("scsi: lpfc: resolve static checker warning in lpfc_sli4_hba_unset") has tried to fix it. However, yet another potential null dereference is remaining. This commit fixes it. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Fixes: 1ffdd2c0440d ("scsi: lpfc: resolve static checker warning in lpfc_sli4_hba_unset") Fixes: cdb42becdd40 ("scsi: lpfc: Replace io_channels for nvme and fcp with general hdw_queues per cpu") Signed-off-by: SeongJae Park --- drivers/scsi/lpfc/lpfc_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 69a5249e007a..6637f84a3d1b 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -11878,7 +11878,8 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) lpfc_sli4_xri_exchange_busy_wait(phba); /* per-phba callback de-registration for hotplug event */ - lpfc_cpuhp_remove(phba); + if (phba->pport) + lpfc_cpuhp_remove(phba); /* Disable PCI subsystem interrupt */ lpfc_sli4_disable_intr(phba); -- 2.17.1