Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp27587ybt; Tue, 23 Jun 2020 14:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3iZhGIT289ukBuYnnLlmombstQK6muUjSY8rBK9G159PQzYJndly2fmBKYp9Cdu5NLRif X-Received: by 2002:a17:906:694d:: with SMTP id c13mr16031529ejs.337.1592947348564; Tue, 23 Jun 2020 14:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592947348; cv=none; d=google.com; s=arc-20160816; b=XR7qSx0UdMcypDROfgIyISgH0Ibje16JyHV0rnF8uGYQuHpTIUDDgty1mus6VgpF02 vyRhMjlhMj1TaJ3lsb907Eqye4GJZpNkXYjpjuwfC7dP6QGIc0dkggJUHGiYwdWsg8kf z5AKe/YOq8hbwECMAQAxYj3fcNu/A9Mb5+CxOlgMkPdzaFYtqaLgJZ4TosVMbZxQ6f5Z NQdBgmZpFdlRtf1ICcKqv2Pb/AUtYYQcE2H9Q26C8seeedUqsSnDbv8cM/7qW0ZdC5S7 Ct8IsBH7Yg9PlQVoxsgBUG/A2YL1TgETdOGUdArzxXL+RO9v3B1TaO7zK7FnNeNsueeu V2Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=8GtuMGPUaS390TqO5z4ppfXD7rQJ/F037h9evN14ygA=; b=bT9T+6mKt7dkpN+5veBJFeCSwBk0bvxbF/U9V84n94w1wFCGzha3U5hCYEhOuE5EDr Na4ahAPVq/hHx62DSMaUYLquW3WjWR6zRJRWO/kwA/gSSuGe2kkiYyBIwcsHAp6i5AiQ BDHpsn+4ikUQGRSWG02Jsn6VOdlI2bpCzIOYRikxgYyRqVsBcUEw0om7nz+TJAh6YkOM NlNdDKKA4PpnoNl/0a0i82sZoxDfu7IJG1sSWT4xekLfpvbFCngaeXeQmErIMGf34BMf 7KOcGwBtxq5vOyQtJc+jXq0jx8LI+EDO/TZyUcovO+H7BFnXxrjh9vldhHcN4N2YoPxs SnOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=UeXA81lY; 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=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si11736490eja.429.2020.06.23.14.22.04; Tue, 23 Jun 2020 14:22:28 -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=@broadcom.com header.s=google header.b=UeXA81lY; 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=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390282AbgFWVUi (ORCPT + 99 others); Tue, 23 Jun 2020 17:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390283AbgFWUXU (ORCPT ); Tue, 23 Jun 2020 16:23:20 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F491C061795 for ; Tue, 23 Jun 2020 13:23:20 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id j4so9612243plk.3 for ; Tue, 23 Jun 2020 13:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=8GtuMGPUaS390TqO5z4ppfXD7rQJ/F037h9evN14ygA=; b=UeXA81lY2Dk/K6Xv/2qrjX76DJuWeAmT6jNVUMl2qas0bB4/Xq2A+K5qs7yXGrQ+XO mwxD2EAVmkxFTRya/JYVHKi1xwtP25wHgkoYM4HMrUhXW7GS9mEQqjFAZyBl/iHLinb5 NBhuRbQiglGun9uYgKwuidd8G5uUNfRAKlWE8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=8GtuMGPUaS390TqO5z4ppfXD7rQJ/F037h9evN14ygA=; b=bHEMY1BZTNNIN2Zk4d8c2uyYm825swqBm0JldgML9W9FJ5fEcMECnsAUC/Oy0BFIEq uHvBFHHiKorOg2LhB8F6sYd0wgqne8XpLIeeeYDz/a5AZGiiL68qT+z0cHmqY7zRTZm4 WZKJLp/MkJelTGzxEjrjyyoVnVeGLqdP78vq+g8s42+fVG0EuiLYi+k0qgNYTc/gdRfN 2RBkkkkfwFQVePI7oLFoQTJdhWvEhxwFG4GVfWU9Vf3gLCBAb0FWi5GRKN9lNOqkr4Cn QZYBfz60JENv3qgDqtRWH+R72GcX9xImxhCKvDHRNsBOXF8tx5MmRzI22xE4c6Vc/eub BIxw== X-Gm-Message-State: AOAM532i9UjQ2qqJG082CnOyiAZ6UWGnZthgGr+swWP4C2TsN5TI8FOm pfhQJRjdfUAhEyaxpYjxK1I3JctsDHs= X-Received: by 2002:a17:902:b60e:: with SMTP id b14mr25563736pls.81.1592943799964; Tue, 23 Jun 2020 13:23:19 -0700 (PDT) Received: from [10.69.45.46] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id ev20sm3141936pjb.8.2020.06.23.13.23.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jun 2020 13:23:19 -0700 (PDT) Subject: Re: [PATCH] scsi: lpfc: Avoid another null dereference in lpfc_sli4_hba_unset() To: SeongJae Park , jsmart2021@gmail.com, dick.kennedy@broadcom.com Cc: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park References: <20200623084122.30633-1-sjpark@amazon.com> From: James Smart Message-ID: <470678bf-2e08-c75f-db14-7569cc4fe4c7@broadcom.com> Date: Tue, 23 Jun 2020 13:23:17 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200623084122.30633-1-sjpark@amazon.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/23/2020 1:41 AM, SeongJae Park wrote: > 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 inlpfc_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); Reviewed-by: James Smart -- james