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 4101931B828; Sat, 17 Oct 2026 18:09:37 +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=1792260579; cv=none; b=gK4oTLZtoPkabNuP/FCO3B0rUhs+6T2x7rkyggDrtJkrLH3Qc0bBcDCTfObN4Uo7pUATOlI3OGrFbqqinPAbIKY3RpMvEMghFl5LBDACC4ykV73klbGXjCtqc9oy2D4JZ+rVOXDJmojkjKY0OV17KMxn8VnK4OdRIHYoqUEtgQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792260579; c=relaxed/simple; bh=k0lnDT4BTPj5UbF8CEbJzrO1raNXo1CIYlIfZ6LRbZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DyJ2ChlrjoEHWXbXjl51JVPon5cgE5vGYT7VtYpxs+xln7QHz4GkUjf/lrN7TVVKKMsGGe+6/mjR0trktmNMDWuqapOaaJNXuV2t+lt9CvEmOAs6B8uh6C3mFi49p/3YObqtSnYWY6LKVc8+CqEY14wfo7Gn/rcTPtTdS736D88= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XkBvatIA; 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="XkBvatIA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 414E21F000C4; Sat, 17 Oct 2026 18:09:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792260577; bh=dHGZxmRvAafNwtoY4r+jLbLb/s8OrYnp51i8u4HcZ7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XkBvatIAngX4NCZ41WA8h3sqPpgjtoj5gb18FxdSDclM8y3Y/V7bJsXrM2syj7E3Z HUFj9tCcEfYcEqUyYFRqXl1y/jpKPFjiuNQzrXso3jlXSC+aw+0a2dX7jeiC2ro2xk fmuMG/q3UOSDVAd7fGw0g0afSrFJB6X7T+bKMOb8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Nilesh Javali , "Martin K. Petersen (Oracle)" , Sasha Levin Subject: [PATCH 6.6 1584/1674] scsi: qla2xxx: Unlink NVMe unsol ctx before freeing on LS reject error Date: Sat, 17 Oct 2026 18:04:16 +0200 Message-ID: <20261017160511.747376843@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nilesh Javali [ Upstream commit e46160a5d4fa59bf4d5f3412b6b5cb79edb967dd ] qla_nvme_xmt_ls_rsp() obtains uctx, which was linked into fcport->unsol_ctx_head by qla2xxx_process_purls_iocb() and is still linked when the NVMe transport calls back to transmit the LS response. On the error (out:) path the function frees uctx with kfree() but never removes it from the list. This leaves a freed node in fcport->unsol_ctx_head: the next list_add_tail() for that fcport writes through the freed node, and a subsequent list_del() can corrupt the list or panic. Unlink uctx with list_del() before kfree() on the error path, matching the other free sites in qla_nvme_release_lsrsp_cmd_kref() and qla2xxx_process_purls_pkt(). qla2x00_rel_sp() in the failure path only returns the SRB to its pool and does not invoke sp->put_fn, so the out: path is the sole free and uctx is always still linked there. Fixes: 875386b98857 ("scsi: qla2xxx: Add Unsolicited LS Request and Response Support for NVMe") Cc: stable@vger.kernel.org Reported-by: Sashiko Signed-off-by: Nilesh Javali Link: https://patch.msgid.link/20260730155838.2119230-27-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) Stable-dep-of: 76da0c43c63e ("scsi: qla2xxx: Serialize NVMe unsol ctx list with a per-fcport lock") Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_nvme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 23481b5d42b39..1d2f67d450203 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -447,6 +447,7 @@ static int qla_nvme_xmt_ls_rsp(struct nvme_fc_local_port *lport, qla_nvme_ls_reject_iocb(vha, ha->base_qpair, &a, true); spin_unlock_irqrestore(ha->base_qpair->qp_lock_ptr, flags); } + list_del(&uctx->elem); kfree(uctx); return rval; } -- 2.53.0