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 D46A42DB780; Wed, 9 Sep 2026 14:30:14 +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=1788964216; cv=none; b=Y1A0DuuNz3+7r1mETVrlPAw7A0JBuvwLR+W9d+94YNdTaC8Vks73KeAICzdU+v9Te3xZaC7XrrEIE1Y/CYhzF7C1KV7DJh5DwQ7iYpfR1Y76er9c4s1tWqRAc+lkYv2hmVzIqwMVVSxi6r6mH1ZVRkZKnyLAM9z4mwU61c0ZGFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964216; c=relaxed/simple; bh=cFNm7I03CTHL6abiwZ046w/0F4CkLvRJd8HV03vqqk4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hBr7XaIQwBWFMfALc/V02Vx1R113pfyI9Vub2UOfcv3J3WgYIOVq1CP/7ymg7Ypa3ImovvnvMNCZxIehsZnPI3K167MXtClpHFleBW3xJkGvzgd6km2oQlAvs00+PCycnD+a7wjimBOnBgoBDeUahUkuAlDm1gQWl5ySEFlS9jE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a3MX0Bak; 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="a3MX0Bak" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A2EF1F00A3A; Wed, 9 Sep 2026 14:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964214; bh=bzsrbA8Eg0Ded9BSYl1FrXjtt2OM/5yI1OE6BvC87pM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a3MX0Bak3vR1P39wz4fuR/Z9lYnxz6/8aM/zGf84rpgm2kXr33oZ/yT2UqSj0TRMo mus3CeXFomCt6gURxI4VFJYMSuPHIZpjNtQxZyIUSvGs0IdD761PNWCWewrb/EgRwk OUMPkrTSkVYSwz9QwLVhXWEGsq5+lKruXEQMEZ2I= 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.18 345/583] scsi: qla2xxx: Fix NVMe abort reference leak on repeated abort Date: Wed, 9 Sep 2026 15:40:30 +0200 Message-ID: <20260909134249.931433986@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@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.18-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)