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 E8BC6387348 for ; Fri, 11 Sep 2026 18:08:17 +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=1789150099; cv=none; b=JcpLiYoThgwq5tzDGrPFP6Oglkk4ICc+tLkYnb4qhsNtr3f9Qf9+ii7fNHxzEadS4cajJcGmYBWiETNMANCK9Ht+KKutbFTxdTyCnrOdRozV4r1zC4i/74EN08knJlK/slrPenyeev/SOKS0AdtHPxWqVMIGpRkJv57ef6er7OY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789150099; c=relaxed/simple; bh=YtFwx1WarjPmn6yUDwli3iD0gWa9Q9INy+wrAsxL2wI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k4NFR2i3OUIZW8fFN8gwvIG1kA6VvabG/t3y74nu5ajW3BRiCxE4hBPAkl9YCdpcfXuAJBvV1Nm95HbtWmJ0SXQbbCux4CmNzf6dMRcYP/N4ehBbil0G0NOJJbCSeAmchgYZhu+qaquWhKWGfUYLU6nRV78e4MHXaR8ss10M068= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AbaSmtXb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AbaSmtXb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2E101F000FF; Fri, 11 Sep 2026 18:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789150097; bh=GUUyODMzrcsXRDekRBFIbQIuNcGKUHH/lLK1ufv5TFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AbaSmtXbMp4AMZu8EqNVyFTK5PL02Bq2u9YGS9qIYV0KZuur2FFywX+r3V94KOWe+ H3QQMin75VwioXmYp/Dz8yKHluTUTOhQBJ375DGBt1lA6DOPmyayRAUYBAfcWS2gQF SQEMMW8+7kT7eBL9BRTM8sgyEoaFqo7+1+uAe/ugeDH7W6NOHDi3YQw/NRWbt7JIz6 xuk9KkD3/OfpDh7L14/BKBNV37neo9AtQCibPqx1ahz67OeG9pLaJivxq+RB5axb/N WLg9vLQJNntFOXlONI/ppfg7c064/LzerNiUAlw7zfa/gByZd+O03zt3E2k+hWIsRC oS4pQyiQkUYDQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Nilesh Javali , Sashiko , "Martin K. Petersen (Oracle)" , Sasha Levin Subject: [PATCH 7.2.y] scsi: qla2xxx: Unlink NVMe unsol ctx before freeing on LS reject error Date: Fri, 11 Sep 2026 14:08:15 -0400 Message-ID: <20260911180815.1299302-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026090901-spooky-activist-b1d2@gregkh> References: <2026090901-spooky-activist-b1d2@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) 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 b84fe71ea340d..ebe236f5b5d50 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -446,6 +446,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