Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1020326rwi; Wed, 19 Oct 2022 05:56:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4i7/ZBzYZ7rPQRDMd8D2Y5iBKyhwnDZ82e4ILDKXcDSLpol965LreiSnYj8Pct+Gb5P2OS X-Received: by 2002:a17:906:8474:b0:78d:ce9c:284e with SMTP id hx20-20020a170906847400b0078dce9c284emr6883775ejc.702.1666184178550; Wed, 19 Oct 2022 05:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184178; cv=none; d=google.com; s=arc-20160816; b=u526vmTB5nH2vt/H6Juii3u75jOnoW9pesCOtbYxwbtMGyRSZGGpqKdjkcsnKBjtAo 2OJuESahPQthTkDirQhN61i4v+ZD3cZW/xkaIsoePNJNPLxprfdhBZabvQEypsmWVp9v qjdFCyQyc02cszizpt6tYT+gILoPnI0IT++Ilcz1rjl4iJzpMXxZ8AXjKAHi+Pc9opGY j+2mOkXiSl/Q6I1X2dcDD8/3UR91FwwfrLytyqJjQtlkfdHpbl1YoJ8E0AA261mwUYJp Zma7OpZvU5uGIVZ9dCBPJw9PrTxDfq3GRvq/ZQhD8+AjkmUd1K8gCr96MW7rmeegpW0r 3pow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nP+zCCEqeSPA4JQWBDFyMAt0mF7WHKpjyGjdsDTE5gc=; b=cb+xkD29rZOzgAxOdMDutuWTTO2KsyIGIxTDiXSH8mfsZa976tQlVdkqRw4xVhkRbx QcKzuRXMEdfs3WQgCM5V21zAgUnCXn8ap5nknId0lMsiQks+08zH5YEKsu55mv93UcHp uwNKrGNE3PeV9av5TnoiM3Qg8AC7Lyy6SlAvfgHRF6B7oJbaEuPq/jgPC7VGIEnnsVa1 O3dA/rDqTD11LKkWJcoQTdcI+tEoLRB6QtMnA94Ile+ndTkinfEWjfhKWFcNZrjqbDRl 9bcThqfItpmM1jk9KkSID8gZKO2xzFLjlxAXrHG6pIVYAtc2yfqDk3LOJiz1xpvL+oc3 bNXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dxAI15kN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht15-20020a170907608f00b0078d878d8fcesi14657437ejc.222.2022.10.19.05.55.50; Wed, 19 Oct 2022 05:56:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dxAI15kN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbiJSMcB (ORCPT + 99 others); Wed, 19 Oct 2022 08:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231265AbiJSMbk (ORCPT ); Wed, 19 Oct 2022 08:31:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AFF44A803; Wed, 19 Oct 2022 05:09:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E41F617DE; Wed, 19 Oct 2022 09:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23FA6C433C1; Wed, 19 Oct 2022 09:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170819; bh=ZFoYiT9y2/iVY1FbCrXKpOhrfl3lZzZKHp9H5oPiBIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxAI15kNBHcTff1TM8GBU3CoAtLYmSgp5D7UBVyKwb90kgHPNSMTAm0u4dO5toGMD 4YqbKkPXXPbgPRPUAwoJF7GApKCXY6zDNtV+g9/ErMjKbJowMiHFmQszSyzFIiRyhU 546EiygB7NEbi1CO+VB1eQkQfA9GRkNe0l8oN8tE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 799/862] scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID Date: Wed, 19 Oct 2022 10:34:46 +0200 Message-Id: <20221019083325.204708073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 59b7e210a522b836a01516c71ee85d1d92c1f075 ] An error case exit from lpfc_cmpl_ct_cmd_gft_id() results in a call to lpfc_nlp_put() with a null pointer to a nodelist structure. Changed lpfc_cmpl_ct_cmd_gft_id() to initialize nodelist pointer upon entry. Link: https://lore.kernel.org/r/20220819011736.14141-3-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_ct.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 13dfe285493d..b555ccb5ae34 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -1509,7 +1509,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_sli_ct_request *CTrsp; int did; struct lpfc_nodelist *ndlp = NULL; - struct lpfc_nodelist *ns_ndlp = NULL; + struct lpfc_nodelist *ns_ndlp = cmdiocb->ndlp; uint32_t fc4_data_0, fc4_data_1; u32 ulp_status = get_job_ulpstatus(phba, rspiocb); u32 ulp_word4 = get_job_word4(phba, rspiocb); @@ -1522,15 +1522,12 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ulp_status, ulp_word4, did); /* Ignore response if link flipped after this request was made */ - if ((uint32_t) cmdiocb->event_tag != phba->fc_eventTag) { + if ((uint32_t)cmdiocb->event_tag != phba->fc_eventTag) { lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "9046 Event tag mismatch. Ignoring NS rsp\n"); goto out; } - /* Preserve the nameserver node to release the reference. */ - ns_ndlp = cmdiocb->ndlp; - if (ulp_status == IOSTAT_SUCCESS) { /* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *)outp->virt; -- 2.35.1