Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3654701pxb; Mon, 24 Jan 2022 14:32:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjPbzFHYI4LhdCfPlrHzn8VytZ1Cv//AkBAAtwwxvTyCg+HkxgzjahwoZrGOILu/jJkJ56 X-Received: by 2002:a63:79c2:: with SMTP id u185mr13591818pgc.74.1643063576789; Mon, 24 Jan 2022 14:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063576; cv=none; d=google.com; s=arc-20160816; b=yVdVzIVqMupOPCkm+BJnRqynuG0TzcI/hEB9hRHx68umlxcknBO/8Og2+2a6isdXgG oWx6y+BKTggbUlfrAIRFH2S7LJBG/9pvdGLnNMWJqEBoUej5I2hrLqwvzv6Nyh6pJXpV BQnHwPNk04gfIBWaNnEAHlf5pCu2TOQEyVuvw6WfeXwC4FOenbqc1RgxXBjoV93ndG5w IYxP1vLua2fysWxaG+aFEQbzjV3wUU03XvRIBNtn9+JExVroQ4vXGWL/ZqUzuJYmUT5z 7uaexOBWgSx+i7q7P2x2vk9401Z1zmoTTzmdeyVNaV/H85T12XUb1hR4gD1o9eux7o7x MySA== 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=7487pohmxc9DFegIvZ3nKVjpqe2C9GJXi789BZFYfEA=; b=KR4JoogGurc4UVnDHjqwt76QvKHjUf8H8QdtFkiQLk7hRsfwCy65U+xrSrDlGksYc1 td4ntK07JLF7+YhOgL2Gu0N+boRjH9WGgHyT4aKT9Dem2ZEn1lqy9kOj8QqytkazdTQd ODUInC6zFd2mgP7lhcSBO5cRtF8cPJcLKjsh2beAcl/7Fj5fZdtQUv/UqV/DorC+lF6D PnvlMTjI5XgZozmaJ/LBqrCJfT/SjalD32MEREmRpNlqV31uTNY11f21L0R9lycYNVWU rzOaNtxNT4B9AolNfUrnukBJqs8J2QBQ9ejBOwM8r38Q3LZJUoxmZRR5EmucyVpOzR+z dvfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zl1T89EY; 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 n16si16797500plh.462.2022.01.24.14.32.44; Mon, 24 Jan 2022 14:32:56 -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=Zl1T89EY; 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 S1588000AbiAXWa1 (ORCPT + 99 others); Mon, 24 Jan 2022 17:30:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48206 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378062AbiAXVio (ORCPT ); Mon, 24 Jan 2022 16:38:44 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id B55CEB81188; Mon, 24 Jan 2022 21:38:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9EB0C340E4; Mon, 24 Jan 2022 21:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060321; bh=AZdeogpZIVfXj08F3oNVbYOQIuzVXxnygZlttam14NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zl1T89EY4+98IcslDj/QAVT/46j/Agx3z1hkgNjSyKaxLdM05hunVmXfymHEaevvn X/7jSkAF3OqdGtl2S1Pin4QZKmr4d3foZBa6ys6Z54jUDp+zeTl3B7o5/uEdGOXrpo y8tEtUTS7YWhXE7IjP0c1rgABfBL/E1XDZbv9c9s= 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.16 0866/1039] scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance Date: Mon, 24 Jan 2022 19:44:15 +0100 Message-Id: <20220124184154.404731249@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 @@ -3538,11 +3538,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; }