Received: by 10.192.165.156 with SMTP id m28csp28601imm; Tue, 10 Apr 2018 15:42:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tbgMRh4dD/Ql4XROhAEcsKWlCXW1+nMEzalhPL/kZ7Mhmb4wOeJdDrsC5M8T5vZe8Dp01 X-Received: by 2002:a17:902:c24:: with SMTP id 33-v6mr2381061pls.88.1523400164270; Tue, 10 Apr 2018 15:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400164; cv=none; d=google.com; s=arc-20160816; b=kzP+ZYoaTRKjmsZhBxi3dGQCtCkhfPfrG+joTvsRoNz+NF9/S8AQYYcHYMRHZ09O/X dlzO3mngQv1QGKGo6uVUVIa3T7MC0DGDUzkVoSsrfQLCQRZjN+tT2JLwxZDwbZcfzOjP 3I3S+QJGKZiAOFMUuRXTdH4Gg1RFFYBvuYC4Y7wGEWZDwdo7R5zjAcjQJWcuvXCd2uIn 3LCoDnVVHan3dZnX/3XpO0GZlu4cJkA1asMrZEre54aEUK5ITdxzJfXVMr51JmkxLkYM UmuKrf8eTDmxOvk1hDDNZLRsA2N2xaQY1WHAr3RNE8Vqq8QLoLgyK1vdh8Z+uk6ax3MI ac9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=63hQkanNs38MSIhZjxEsdY84QusNfoBaodugVPhIh2I=; b=wqr9BpRJkMw5PFUccKr1Ti+i0xelcHnGIfrI6jCMVd2YPUv8pXk0FW02az/S0A58xw DQ9yX7nS0ubSOfznZ84I5HGMrKzXsQ16AtOi+thB3ngQV/O1WFSQPibTxRWP3MizcufT AIh96e2SOL+leB6cmVf5awis8AzsnXyu1kVK3ArOTV7fNCKUMn9Gj34DRkLB+ZMLbOJu PwfBK0a4YJ0vnPD3CyJxAgxfALntPz3fjeC+jsItFYPSPPOlKEiwq1UjrksO3lmWnP/7 Zac8780bLKxvETz6NV9MoO6DarfyCiYiaflANl1LgyEc3LcsAfA964KFXNWcX7sY68hK zVRA== ARC-Authentication-Results: i=1; mx.google.com; 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 f130si2398773pgc.304.2018.04.10.15.42.07; Tue, 10 Apr 2018 15:42:44 -0700 (PDT) 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; 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 S1755828AbeDJWhl (ORCPT + 99 others); Tue, 10 Apr 2018 18:37:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43848 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754893AbeDJWhi (ORCPT ); Tue, 10 Apr 2018 18:37:38 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C8D5CBDB; Tue, 10 Apr 2018 22:37:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parav Pandit , Mark Bloch , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 072/138] RDMA/cma: Fix rdma_cm path querying for RoCE Date: Wed, 11 Apr 2018 00:24:22 +0200 Message-Id: <20180410212910.495781141@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Parav Pandit [ Upstream commit 89838118a515847d3e5c904d2e022779a7173bec ] The 'if' logic in ucma_query_path was broken with OPA was introduced and started to treat RoCE paths as as OPA paths. Invert the logic of the 'if' so only OPA paths are treated as OPA paths. Otherwise the path records returned to rdma_cma users are mangled when in RoCE mode. Fixes: 57520751445b ("IB/SA: Add OPA path record type") Signed-off-by: Parav Pandit Reviewed-by: Mark Bloch Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/ucma.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -914,13 +914,14 @@ static ssize_t ucma_query_path(struct uc resp->path_data[i].flags = IB_PATH_GMP | IB_PATH_PRIMARY | IB_PATH_BIDIRECTIONAL; - if (rec->rec_type == SA_PATH_REC_TYPE_IB) { - ib_sa_pack_path(rec, &resp->path_data[i].path_rec); - } else { + if (rec->rec_type == SA_PATH_REC_TYPE_OPA) { struct sa_path_rec ib; sa_convert_path_opa_to_ib(&ib, rec); ib_sa_pack_path(&ib, &resp->path_data[i].path_rec); + + } else { + ib_sa_pack_path(rec, &resp->path_data[i].path_rec); } }