From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E183347ACCA; Sat, 12 Sep 2026 11:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789214024; cv=none; b=ZVthD7gzzii8xp92urOzLjpAMRB4/BUXWjN4Ns3GCr7xkL/ZTsrA7QLEvC+2qfB/QflxSrRXoK2t414Uzx05qXEeHRqJOcSAIcH+EBOikpRPiOrmG/DN5qIo3P7CcfwyNmm608bfOkhM6kTCE1OlklfXTAjfs82/zLn2+BD/wuk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789214024; c=relaxed/simple; bh=+9Cy5xmDJhkvzeEWrCgKNqoTvBozk89fs3Kw/A0sa50=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cDD49HnOPwlF/bnmcm30mGSpELlQOJ1Qhk3hLSj0BN+bnWnvL5fwhY6w+B3tb2RV2AJMYmwq7Xyzzv2gqvAHDBlAWSbhxGdBds0Xsq91Er7CqpjWIliZ30iaa0o51FxunnQwN81oNT+/T/ufTuQPf3szMp4703RWEAa8ogqsN4Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RJzrM7J6; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RJzrM7J6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9A391F000FF; Sat, 12 Sep 2026 11:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789214020; bh=sFoExLFpRph2dhcC2fK2bwcMJi/QNp5O/Gfdkwkh98I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RJzrM7J63sW7jJVLcEiQZVRSHedFmPv3F2rJCHCD//URhHbgO8Cn+LNMDgnKrsMHv jRdxZfvu1Dz6ZZk8tb5/frDRvB+0KBZLBb3OtKVsjwJ6w5wMMgt20w4FrIvrtPBpGX 9Qyp3OQpncTTY3SHRCQUaWVt50mloDj033IdRci0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Nilesh Javali , "Martin K. Petersen (Oracle)" Subject: [PATCH 6.12 0242/1376] scsi: qla2xxx: Fix NVMe abort reference leak on repeated abort Date: Sat, 12 Sep 2026 08:44:28 +0200 Message-ID: <20260912065612.935038625@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nilesh Javali commit 06b5b2a5d499323f1c3256ead35798e8e3d15e60 upstream. qla_nvme_ls_abort() and qla_nvme_fcp_abort() take a command reference with kref_get_unless_zero() and then call schedule_work() on priv->abort_work, ignoring its return value. qla_nvme_abort_work() runs once and drops exactly one reference via kref_put(&sp->cmd_kref, sp->put_fn). Since the per-abort INIT_WORK() was moved to submission time, schedule_work() now returns false when the work is already pending, for example on a concurrent transport teardown and timeout-driven abort of the same command. In that case the reference taken for the second abort is never released because the work still executes only once, leaking a reference. The command is then never returned to the NVMe-FC transport, which can hang the port. Drop the reference when schedule_work() returns false, so each kref_get_unless_zero() is balanced regardless of whether the work was newly queued. The held reference keeps priv->sp valid for the put. Fixes: 7e85f6dbc856 ("scsi: qla2xxx: Initialize NVMe abort_work once at submission") Cc: stable@vger.kernel.org Reported-by: Sashiko Signed-off-by: Nilesh Javali Link: https://patch.msgid.link/20260730155838.2119230-25-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -466,7 +466,8 @@ static void qla_nvme_ls_abort(struct nvm } spin_unlock_irqrestore(&priv->cmd_lock, flags); - schedule_work(&priv->abort_work); + if (!schedule_work(&priv->abort_work)) + kref_put(&priv->sp->cmd_kref, priv->sp->put_fn); } static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, @@ -548,7 +549,8 @@ static void qla_nvme_fcp_abort(struct nv } spin_unlock_irqrestore(&priv->cmd_lock, flags); - schedule_work(&priv->abort_work); + if (!schedule_work(&priv->abort_work)) + kref_put(&priv->sp->cmd_kref, priv->sp->put_fn); } static inline int qla2x00_start_nvme_mq(srb_t *sp)