Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3396079rwa; Tue, 23 Aug 2022 04:12:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jgBpFnkC368UEzyOjaufdgk80oS11aeMInuBBrqC74dYpe/Bn3FunM/9KK66xAZe/SK0D X-Received: by 2002:a17:90b:1986:b0:1fb:1105:f311 with SMTP id mv6-20020a17090b198600b001fb1105f311mr2750053pjb.84.1661253130865; Tue, 23 Aug 2022 04:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253130; cv=none; d=google.com; s=arc-20160816; b=E5wP3iJO8m/Gh2AhTDg5TE1Avpr9vLyYmjFVLq28BTBAbHMNevSmwgP6ABeqe63SxH ttdCIfNYJq23OL19++nLGqo3S4ULBagaX/fXcjevP8mDZvTpltnyHUIURBwksRy1qNCR Zb8gHFpNvgtySz1n8qXo1FEUoUE4gMETpi+xeenom87USoa6IjpwJfqIw6tKY6vZ8mEA 8srSf/+/nMIw40UchAqQ6kN2ZbJNUj+zOVeRSEhITPyFdqPeQWSpVXb+g2O9pl4Qp+lF NdR19m5bhTNao2nubVTLYkGAGfgQLCO6Qx9m25PXt0lzi8TFFo25yqv/GVrlkv3XrRZJ Qc+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EzftiznbnHk5UBZ1RNb4R1FecO7xmmQee//9VPUKZdg=; b=YdadXYXfO2vADg2jHBemvXJdRkCQuAxNsQNBwRXXGht0Q6s/KX4DdsS8+JaHx7F7pH SPiBlw/kk4asHWL4azIEIdAklqUqS4oaEQpjv3dLagioAmz/VRTeStGxq9yPWbaCPbqR wPpLCNlVeFfuJPkpQ84026emHyAY45VQ+H/yf1bOKe8ogB17fQtW3yBY6iv7Dc5ECtSG AOVNIq4RvBIMbBCzCyK8sAVB9Ltr0vEXL1DOWr835paijnUGjxmyEibEEAT2cmsURcFH H0kHL0+mdbgvBUBl4XWhxa/8AFw7CvW9U3mfe72H7VBRl0GIcR1/NkPVs+6eOgO1UyAQ BQgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CEVzZGKr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r201-20020a632bd2000000b0042a560b4d30si11692465pgr.500.2022.08.23.04.11.59; Tue, 23 Aug 2022 04:12:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CEVzZGKr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346384AbiHWIo0 (ORCPT + 99 others); Tue, 23 Aug 2022 04:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238953AbiHWIlu (ORCPT ); Tue, 23 Aug 2022 04:41:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 461777A752; Tue, 23 Aug 2022 01:19:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 872ACCE1B37; Tue, 23 Aug 2022 08:19:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 869E9C433D6; Tue, 23 Aug 2022 08:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242740; bh=25cqBIIziV/XcfFoMUqaT4vBZAn3Vln87Mt8tEYrRsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEVzZGKrOC1fPL1DJfZlhp58rgpZFnnrNsJZ0Qvm7ZtoZ8ojmaasTzKqqMonTl4/C oA9fZcqUTBRuiv3aRJflHFHeCgxTpwNXogXO99vxXPbhzfMCX6nGHoqbyQKq4LDIHK 5VjubVuEhvgY7RTTkYbolULgs9kK3VNfKBTKOB98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Gorenko , Max Gurtovoy , Leon Romanovsky Subject: [PATCH 5.19 185/365] IB/iser: Fix login with authentication Date: Tue, 23 Aug 2022 10:01:26 +0200 Message-Id: <20220823080125.955814036@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Gorenko commit d6d142cb7f79bec6051c5ecf744b7a5309c5a0ee upstream. The iSER Initiator uses two types of receive buffers: - one big login buffer posted by iser_post_recvl(); - several small message buffers posted by iser_post_recvm(). The login buffer is used at the login phase and full feature phase in the discovery session. It may take a few requests and responses to complete the login phase. The message buffers are only used in the normal operational session at the full feature phase. After the commit referred in the fixes line, the login operation fails if the authentication is enabled. That happens because the Initiator posts a small receive buffer after the first response from Target. So, the next send operation fails because Target's second response does not fit into the small receive buffer. This commit adds additional checks to prevent posting small receive buffers until the full feature phase. Fixes: 39b169ea0d36 ("IB/iser: Fix RNR errors") Link: https://lore.kernel.org/r/20220805060135.18493-1-sergeygo@nvidia.com Signed-off-by: Sergey Gorenko Reviewed-by: Max Gurtovoy Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/ulp/iser/iser_initiator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -537,6 +537,7 @@ void iser_login_rsp(struct ib_cq *cq, st struct iscsi_hdr *hdr; char *data; int length; + bool full_feature_phase; if (unlikely(wc->status != IB_WC_SUCCESS)) { iser_err_comp(wc, "login_rsp"); @@ -550,6 +551,9 @@ void iser_login_rsp(struct ib_cq *cq, st hdr = desc->rsp + sizeof(struct iser_ctrl); data = desc->rsp + ISER_HEADERS_LEN; length = wc->byte_len - ISER_HEADERS_LEN; + full_feature_phase = ((hdr->flags & ISCSI_FULL_FEATURE_PHASE) == + ISCSI_FULL_FEATURE_PHASE) && + (hdr->flags & ISCSI_FLAG_CMD_FINAL); iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode, hdr->itt, length); @@ -560,7 +564,8 @@ void iser_login_rsp(struct ib_cq *cq, st desc->rsp_dma, ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); - if (iser_conn->iscsi_conn->session->discovery_sess) + if (!full_feature_phase || + iser_conn->iscsi_conn->session->discovery_sess) return; /* Post the first RX buffer that is skipped in iser_post_rx_bufs() */