Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp688272ybv; Thu, 13 Feb 2020 07:47:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyOgHLrBTBNby2CiwcY0r/xU9tZsAY6cAEswN9ufFhwysBMBX8CLd3vGTMwALivqidWVabI X-Received: by 2002:aca:aa0a:: with SMTP id t10mr3229675oie.156.1581608870634; Thu, 13 Feb 2020 07:47:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608870; cv=none; d=google.com; s=arc-20160816; b=HKjD9xzddA9xunVI0MuracTOl0NYqI+7M2Xl12hikdySL+VfD1+wjyyiGspn8fwe12 5nyPMzcMviS7Jd5FzQBwul5vgqf8jCFlr5pMzUDnyLrLe02USVtgGSRqc3jQY36Q61Rl Lng6on1AHSy7NYN4/4KM6zKXB8g3YLkPLeBseZgFOzDgjjpU0aC7V6qq8auPyVhkGjOM PQvYUaircQJhI6atJdNmJgSrDc8XZjAtI0LwFPX76qNk0xNPLHDObyCHBP3CLFDmCfFB bdCDGXlZUczg/pWoRshW1JoN3M076FaqnPifCdqFgrVURn09RKHW4/a14zzHt0cM+kuW tucQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5H7XJy8jSexiwvjgztMhvOQ7B+vtfKVAqnQZnK02yuo=; b=F8s7IwciWFLmHtYq9T/n/RWjXlRWZ3HZDrSAnp6OWiHIU0Z39RUAh0qGl7/PmVBM4v Kk6G4y3s8pwdl8bUdi/isjknC+UX3aqkR03JZnZuwdtFOlT0+Yu4j8PEvTsXxBa3vsMh qkBocIULlvRiZyEZu9ks3Wzrv1u2wcTeztA5Ui8j4GKtebMWPyr5EfqmPjLFkIkVWvfT lwscoW19Fxmdw7mcWpQzIZaFZALgzTYEB0o1MyYVcN8n18ks1mwGBkUTpHrnWHxdn9i9 oTzmxRHfsxiPiMwGwm5V5NCuuSj9jgw4FuiRYd5kmJTumxdiNbJQFt6TR1+1tAyAsIvN mPIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wlNcgDbE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si1390440otk.109.2020.02.13.07.47.38; Thu, 13 Feb 2020 07:47:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wlNcgDbE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729371AbgBMPra (ORCPT + 99 others); Thu, 13 Feb 2020 10:47:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:48578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387650AbgBMP1D (ORCPT ); Thu, 13 Feb 2020 10:27:03 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 358D32465D; Thu, 13 Feb 2020 15:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607623; bh=Kp5ITOmmGRq5nUzVovCIS4LzsjYjFZEjGH8vi4E4nvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wlNcgDbEu0+M3EN1y663NVDmtGMxawgTIh7dfST0K54bXhm8SoJEOgfHnElROxrq6 /A9iomX/VMAF6Hiv93uHmfkquxUFfn+gWYqZiH2Q96kzpPYP9AL+Pd3g1/7PKcEw/3 /BCapFVZPi9febq5kexLWZS+fdtZ5ICOAZTfqTzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Gorenko , Bart Van Assche , Jason Gunthorpe Subject: [PATCH 5.4 04/96] IB/srp: Never use immediate data if it is disabled by a user Date: Thu, 13 Feb 2020 07:20:11 -0800 Message-Id: <20200213151840.592525080@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Gorenko commit 0fbb37dd82998b5c83355997b3bdba2806968ac7 upstream. Some SRP targets that do not support specification SRP-2, put the garbage to the reserved bits of the SRP login response. The problem was not detected for a long time because the SRP initiator ignored those bits. But now one of them is used as SRP_LOGIN_RSP_IMMED_SUPP. And it causes a critical error on the target when the initiator sends immediate data. The ib_srp module has a use_imm_date parameter to enable or disable immediate data manually. But it does not help in the above case, because use_imm_date is ignored at handling the SRP login response. The problem is definitely caused by a bug on the target side, but the initiator's behavior also does not look correct. The initiator should not use immediate data if use_imm_date is disabled by a user. This commit adds an additional checking of use_imm_date at the handling of SRP login response to avoid unexpected use of immediate data. Fixes: 882981f4a411 ("RDMA/srp: Add support for immediate data") Link: https://lore.kernel.org/r/20200115133055.30232-1-sergeygo@mellanox.com Signed-off-by: Sergey Gorenko Reviewed-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/ulp/srp/ib_srp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -2536,7 +2536,8 @@ static void srp_cm_rep_handler(struct ib if (lrsp->opcode == SRP_LOGIN_RSP) { ch->max_ti_iu_len = be32_to_cpu(lrsp->max_ti_iu_len); ch->req_lim = be32_to_cpu(lrsp->req_lim_delta); - ch->use_imm_data = lrsp->rsp_flags & SRP_LOGIN_RSP_IMMED_SUPP; + ch->use_imm_data = srp_use_imm_data && + (lrsp->rsp_flags & SRP_LOGIN_RSP_IMMED_SUPP); ch->max_it_iu_len = srp_max_it_iu_len(target->cmd_sg_cnt, ch->use_imm_data); WARN_ON_ONCE(ch->max_it_iu_len >