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 0B09E4B7A2D; Thu, 17 Sep 2026 16:00:35 +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=1789660836; cv=none; b=sufJ4xfRVlEabizUcGnwhGulNu5HRISOzeZVWB57XWY6Kj67jIDjImTs4QBRDElWUf/hmQPdC6jDM+yjD8VGXeTZgpYDWY6SYEVhXQSGuhdFjRsuXVQ3Zmcoht2sunHjuOfo1EyWaiZqYU5VYpyAOetukU8pS6vCwUUFnkwa6+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789660836; c=relaxed/simple; bh=YfucsJGmyL3FyIcx0zlSdlujTiMII4DiUYRBV9j+ZEs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NF92WnHPHUYZZjPXc31lHNT5OW0bEnIMoczTcYkXMkEdgExUjT0NOIGURZcn+cPy0r2W66w04N3I2PX2e+ffKdQSgLs/P+EbbrPH8PcyeBK06Ea5gqIOyVkb7BXZDm4mDKyoSWQufZ3OhauAMZz4abplTYmxTMbms8wVkMdAFS8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BCrd18Wy; 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="BCrd18Wy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6432C1F000FF; Thu, 17 Sep 2026 16:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789660834; bh=nsJP/oISvX87vtkZOBBmVWbyg5pERYnliCwIHkmRk5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BCrd18WyJrk1aAFFSVaFD4H7spuxyEakyqJ+3sIStnLjUhS5CNHUoUd4WVZQvkY4N PwjY6K0gcNpxyxLSeLMOyiaH8GfXWQdjIFsTmbhjGrggwOKl5UXvbcawA84HmznLQY dAecOMOx2uSYPAi4vdR1Z6dXJxqg6hfP1fOz8kck= 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 7.2 724/733] scsi: qla2xxx: Unlink NVMe unsol ctx before freeing on LS reject error Date: Thu, 17 Sep 2026 16:17:12 +0100 Message-ID: <20260917151411.002851129@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151350.597953846@linuxfoundation.org> References: <20260917151350.597953846@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 7.2-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 Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_nvme.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -446,6 +446,7 @@ out: 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; }