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=1796381327; b=pbS8fstMPT1TT6DHN/5622AsbqlxAe22liTVntbRWZeH+mRLh+Nvh4saFiyu3wPzeA7k v3v6AzDVUdMpceM2+tfzi3N65BbRWqU6O89ubFL7B6Iv0KqqoXbhuSQ9qOfxPGkaWNuo7 oZXm9oSgK7NUFJ52ykKbFYcBt8IzmM/nKeaUVk6hVf3Rl0HpMuCyliimlr+9+Sm+I4dth sXA64x1ePeUsEMbiK7P1vu60tFKpUGx91TxVEw+5zkJHld03DUJuwQM6YueHEqmAVtUtS NyFae/5OGsU0A+ou+hKuX8ss9iw4UNPSjuUQan7QUhjrpnE5qdrMYhwgMITbGj0FQqQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381327; 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=R/ZHZpiqNq9MiaanMgyyVSbIkmTxcmcFqtF7/wgVElY=; b=SVS+8bRR9uDDk4JIAm2MZ9b7AJgZeT8B69kEgUT3CiecfZXd71hTRE6FgcjQ1Z5xhKXy T/KUjFNWjjnP2GKLjZAkW7qsF+jyBMT7Wv07kh6o+wSrNmIPpWJg5kJXKmFNDWmnNc+bK qjM27g2yq+yDgAe4qqaqnsVLJreC01JOBNOfqmh9ggSbIS1RyHBmg6VGFoYYVRoj1WEXH i+lqesY2yRiL4DlaYzCzF3bqutGpl9FWbWd2KgXBm7ZcGTbjEX7sxLUoyhwf2WhlSQqFJ MD/NhF8MPgQRqd6ObV3ErvFQYhiOp97bJG19mYVB8jeg7ywOSqnY2Aazcx00a3Umpvg== 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=GtBhROwo; 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 E0620606A330; Fri, 4 Dec 2026 10:48:46 +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=GtBhROwo Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EDD61F000CE; Fri, 4 Dec 2026 10:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381326; bh=R/ZHZpiqNq9MiaanMgyyVSbIkmTxcmcFqtF7/wgVElY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GtBhROwoZTc74/tXI783H+85MqfnTr3qM910XHs2JvaHsear/MzI4Kicz8MQMQ9Fd UR4CxZzALFDmQb8IGPA82P01ysBx5T4RA4VYetsbwy6p0yfxVJm2LA4XaOBOrJp1lF Q1izpxZLWsLeMMXmfUx5GalNwSFP67zyQCJ8BHz0= 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 7.3 653/742] scsi: target: iscsi: Check for existing sessions only after authentication Date: Fri, 4 Dec 2026 19:08:37 +0900 Message-ID: <20261204100652.430626724@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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))