From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384087; b=urHm13xmQRRuH6Eq2FIPdgllZ1SyqVomviNuOIo7ctabBNhT00smOhr16nfDMP7tgiYk tUxB2Z4p9bGDwwhSM9GPwuP4kKaBDF/lMjcKnKpHmzIrqzh8vqakG80L461wY4HIoU+Ai MzXl8O3SgTxJnSFYV0CZZ+jAAfysJrICJFnwuNGN/QPnPMdld9WfMsp76yCV34F2b8JVi 5fIkeacdw6fRRflTFFGko3TM1cowyYXMx+WO71JraYo3Qr8Lvjcl6zKLnp67AHNDJ6y2q C4JaNGoyYmhcTzaJs0Ox6gMTSvjOLe0SlZTZu7AD9Kln7zFYwuLZX+kSrERScwJ/h6w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384087; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=RclNOZNFfoE6tGsKSDdtn24OHWgo1GX+UNyh9qnp5Zw=; b=bj4qus8KjW4Nov50RhTvmPA6hKyKvo0HWzSDPTi+BAKNbENETHSn24VfoLD4ERSDVNxN wrfzvxO4PhMPZWT7ZOAK0krTBQZ6DRFB66U9hW1lAsYH/LZoMIZEYyDrrAK0TW5ucchPq mpM0zkxoqHhVZnT8TNgDUEEOnSnXrqL/nyK1ZqObGDtJrb05ff6tcgKzLadr6wg/re69J 9dI/nkbuHbsR24nzZpLpyq8ENFdgbgOEUCfBA9zcKsjVegzzfkh+1IVCsTw+C5kRwQylH 9Ecpw+097chDhdstAc49olmWQ3RpnBzq5LdHi2sVl84zL/KHLsWBywNRXB9LBSdkeIQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j1Jo5Av9; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C2FD606A322; Fri, 4 Dec 2026 11:34:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j1Jo5Av9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52981F000C2; Fri, 4 Dec 2026 11:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384087; bh=RclNOZNFfoE6tGsKSDdtn24OHWgo1GX+UNyh9qnp5Zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j1Jo5Av9DGIvD4NBBx0Bj5dEozbo/sWJI+IpeY96Gv//GDKwPruMhOC2YeRb9g5EK unQEqCKLAaTelxmxbijtZ+60hnVxx0hxmi81kz7qSXLOlyQYPZjrhjStfdeantgr5+ 3SR2ScaXYMHe4/mrG5w0pnT/FTHUKy0YhTSi45E8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Praneeth Balasubramanian , "Martin K. Petersen (Oracle)" Subject: [PATCH 6.12 489/555] scsi: target: iscsi: Check for existing sessions only after authentication Date: Fri, 4 Dec 2026 19:08:52 +0900 Message-ID: <20261204100627.706354092@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Praneeth Balasubramanian commit 48d3b732e5ad3fffe74e033d9a3cf47ebaa314b0 upstream. In the operational-negotiation path (CSG=1), iscsi_target_handle_csg_one() calls iscsi_target_check_for_existing_instances() before iscsi_conn_authenticated(). An initiator can therefore send a first Login PDU with CSG=1, TSIH=0 and no CHAP exchange, carrying the InitiatorName and ISID of an existing session. The target reinstates that session, which tears down the legitimate initiator's connection. Only afterwards does it reject the login with AUTH_FAILED. iscsi_check_for_session_reinstatement() matches on ISID, InitiatorName and SessionType only. The InitiatorName is not secret, and open-iscsi ISIDs are a fixed OUI followed by a small session counter. A remote peer with no credentials can thus repeatedly disconnect a CHAP-authenticated session and keep its I/O failing. The comment above iscsi_target_check_for_existing_instances() already states the intended invariant: NOTE: We check for existing sessions or connections AFTER the initiator has been successfully authenticated in order to protect against faked ISID/TSIH combinations. The security-negotiation path (CSG=0) honours this, calling the check only once authentication completes. Move the CSG=1 call below the authentication check so both paths behave the same. When authentication is not required, iscsi_conn_authenticated() returns true and behaviour is unchanged. Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1") Cc: stable@vger.kernel.org Signed-off-by: Praneeth Balasubramanian Link: https://patch.msgid.link/20261029205456.1211532-1-praneethb2002@gmail.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/target/iscsi/iscsi_target_nego.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c @@ -982,9 +982,6 @@ static int iscsi_target_handle_csg_one(s if (iscsi_target_check_first_request(conn, login) < 0) return -1; - if (iscsi_target_check_for_existing_instances(conn, login) < 0) - return -1; - ret = iscsi_encode_text_output( PHASE_OPERATIONAL|PHASE_DECLARATIVE, SENDER_TARGET, @@ -1008,6 +1005,9 @@ static int iscsi_target_handle_csg_one(s return -1; } + if (iscsi_target_check_for_existing_instances(conn, login) < 0) + return -1; + if (!iscsi_check_negotiated_keys(conn->param_list)) if ((login_req->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE3) && (login_req->flags & ISCSI_FLAG_LOGIN_TRANSIT))