Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3688134pxb; Mon, 24 Jan 2022 15:24:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyt5sF5mj6lyieyfUVnvA4vR1+inoLWq1SXpieDSi8ZShwTVx/tXii+6/0Nb5J2xKTfsKh X-Received: by 2002:a05:6a00:21c2:b0:4bc:fb2d:4b6f with SMTP id t2-20020a056a0021c200b004bcfb2d4b6fmr15739218pfj.62.1643066645265; Mon, 24 Jan 2022 15:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066645; cv=none; d=google.com; s=arc-20160816; b=A7UjhAYF6rOqFKYFiIFow6FMlLRf1ZVtqBWmTbPyzweOZeqPCqF1ddk2EcwDWs+5xG jBIXpIiWz7XBcLEgkww/mC6ugN4OPjm7zprOQzGh4ZwZFADao4B26BGk26n0XupzsZPH 2vdNN9g7pgfNogxq1tVNc3MJbsvaHCcSvJDdRjk0HeesY+wNrD5Do8nCBcO7AubnktdV 6zGVGDdy6IGAB0tEOTMQBKQ0NNwe4Uh7BUxNRs+cGCvI2EyRbLP8+Exd74TmJ16ulHl2 MstgsuDd0yieIosnx1MLv3q06H23h0G+0vS5VrIDRJUVeCnmX79beC09xTiJpScNbzBx FhoA== 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=4/mKlM9NDQ9snTZ2rr5VBuvzujHJ3AKY507tUT4V2Xk=; b=wOOM6ZePxTIbpX24ukjoPtUhtyLqiPuPRHjfLjlRf5P5fSRJn69hwzkkqEBBEcSZd4 IxwjCzLpLrhTXib+LPFytbAO6YqxggPSy0Ka6VMcofarm+xPEmRRcLfAhW/cVP7XosR8 cnjG5DbGPO+RN93WPY3UAEN2qSypXEd98886ZFxf12z6Ar8HDWQTEBn4t4q5JdfdjO9R WGl/R0Z950H7i8sNEm/2TrsRblCRgmFg/6QmqwYFLURDYoDWrBQmp8IsjaZoCDRsDBBS 2r6rntbNL00u/v2VwwCoZgWjoMNEkP6cyKBzTrbnIS1jSoeYhorK+lvzy6WwyJttarop s0Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GwNTE19d; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si517892pje.185.2022.01.24.15.23.39; Mon, 24 Jan 2022 15:24:05 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=GwNTE19d; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846973AbiAXXRe (ORCPT + 99 others); Mon, 24 Jan 2022 18:17:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1582576AbiAXWPa (ORCPT ); Mon, 24 Jan 2022 17:15:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF3BC0E263D; Mon, 24 Jan 2022 12:44:45 -0800 (PST) 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 2B99760B18; Mon, 24 Jan 2022 20:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00C75C340E5; Mon, 24 Jan 2022 20:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057084; bh=87O7PDaKF+1O4WQmPrJhi9c02SxXIvaMX1rfOhJh3eQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwNTE19dtuOwkiEu4vmubu/UqjCqOIipgnwJqa8OYAuPvxKo/Z1/MUm6s4oAZhGG2 XqJcORu5x3UdKpTeOXktjw6PdoSxuChfvd2Gl9fOpkEMztCiKPVWNHqjwR1Ta3GqEi 67iZMEIg+IZeizuoAkLguThwcsl33PuIVPUVS2tM= 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" Subject: [PATCH 5.15 697/846] scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance Date: Mon, 24 Jan 2022 19:43:34 +0100 Message-Id: <20220124184125.099262815@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart commit 7576d48c64f36f6fea9df2882f710a474fa35f40 upstream. Issuing lpfc_force_rscn twice results in an ndlp kref use-after-free call trace. A prior patch reworked the get/put handling by ensuring nlp_get was done before WQE submission and a put was done in the completion path. Unfortunately, the issue_els_rscn path had a piece of legacy code that did a nlp_put, causing an imbalance on the ref counts. Fixed by removing the unnecessary legacy code snippet. Link: https://lore.kernel.org/r/20211204002644.116455-4-jsmart2021@gmail.com Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking") Cc: # v5.11+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc_els.c | 5 ----- 1 file changed, 5 deletions(-) --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3531,11 +3531,6 @@ lpfc_issue_els_rscn(struct lpfc_vport *v return 1; } - /* This will cause the callback-function lpfc_cmpl_els_cmd to - * trigger the release of node. - */ - if (!(vport->fc_flag & FC_PT2PT)) - lpfc_nlp_put(ndlp); return 0; }