Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4619756pxj; Wed, 12 May 2021 09:22:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU8yrdHw4ts+qKFlMrPK1QANjLrQKrm630ps1NXeYpiiLUmG9n8+UXkWuaAM0p6IA8ffhx X-Received: by 2002:a17:906:ae8f:: with SMTP id md15mr38934267ejb.244.1620836471455; Wed, 12 May 2021 09:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836471; cv=none; d=google.com; s=arc-20160816; b=qKSwf7KoofKblZ5hmpJ6mnLt7h+lI9vZikQOUFxfV284Gl8OsoqsRzESinfHBKXfik yTnqhtn7qKDJMXldngEa+MEElHNzgtA5szPvGJGPw36e8vJwJ2WyQxp20bhZELWVd3zR 5kW6t6b5qJ8uNANAiy0K1NAloWyKWyZoZSCm0bldce39s4K+3C9KWhOD8jEu45/EXTVb 8Thw6U+RBNAdKbdhNMDJU/w7y90JmcB4kDxzOcHDsSSi58XGWTQlwN0N8pti7AfCpnvD dXQRpvkNFL7oMcvhj7I7wSj7S8VxsoIvvt23yu/+wA48JDiblQE8Qp2AVlnajg95Bddo S4gg== 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=efT7a0zhUSstdJ55sFcx5BK5ISIX4+0s6VT+AU25vbo=; b=abwggKVusBlZ0aBoMFN3Xw7B7/zncWG5jDXb/Z+T8vQPq5DFGKRGQDZG4U1r+7WGLs tjpQ342yD/nwWfK8WRgeCAvMS9VRiIYKE2CO0j1UlZpy8v1lfJC3p5ADx1zKBU1T20+3 nwIAlb5Cy9J0CI7/E7ZDYcLb9N5JXEbr0ePYMol4DJXrYx7LYHhR2r2OHzCp78ytRIbw zGS+1ztm/uEFTRYQYNKliA0fhYrEZh8h4qyWxwXzuUd4yMWIPwp5AkGlFUqEr4G24gjP /K21dANrWvymjPoMVlxofHH+uhS5sQxI9XvfR8TODUPphgh0SiI+ZgO+2DpFm4k4/U4c cMRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aiqXzbCN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si150220edv.218.2021.05.12.09.20.46; Wed, 12 May 2021 09:21:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aiqXzbCN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233394AbhELQS4 (ORCPT + 99 others); Wed, 12 May 2021 12:18:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:50218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235795AbhELPgD (ORCPT ); Wed, 12 May 2021 11:36:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D508961C49; Wed, 12 May 2021 15:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832690; bh=a8RFhJwARtnwHO9m88oRTGl3ekcME3WM5bxNr28I6yI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aiqXzbCNMHYqOsCwjL/HcLEnc3wFNx68eCe/MRNsWVVZqpiiWnzifjFrSyUUxE+Tn 2S8jRXrcSb+WFrOEy9KByQFYIgznUCcinAsCfc8rG7aggkbnB5TxNh1tUFNqK+AxDE fNpCK/NeRaCpS7hh1rZIhpC33OX0E1geTbZOAvM8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?H=C3=A5kon=20Bugge?= , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 384/530] RDMA/core: Fix corrupted SL on passive side Date: Wed, 12 May 2021 16:48:14 +0200 Message-Id: <20210512144832.396882852@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Håkon Bugge [ Upstream commit 194f64a3cad3ab9e381e996a13089de3215d1887 ] On RoCE systems, a CM REQ contains a Primary Hop Limit > 1 and Primary Subnet Local is zero. In cm_req_handler(), the cm_process_routed_req() function is called. Since the Primary Subnet Local value is zero in the request, and since this is RoCE (Primary Local LID is permissive), the following statement will be executed: IBA_SET(CM_REQ_PRIMARY_SL, req_msg, wc->sl); This corrupts SL in req_msg if it was different from zero. In other words, a request to setup a connection using an SL != zero, will not be honored, and a connection using SL zero will be created instead. Fixed by not calling cm_process_routed_req() on RoCE systems, the cm_process_route_req() is only for IB anyhow. Fixes: 3971c9f6dbf2 ("IB/cm: Add interim support for routed paths") Link: https://lore.kernel.org/r/1616420132-31005-1-git-send-email-haakon.bugge@oracle.com Signed-off-by: Håkon Bugge Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index bbba0cd42c89..ee568bdf3c78 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -2137,7 +2137,8 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } - cm_process_routed_req(req_msg, work->mad_recv_wc->wc); + if (cm_id_priv->av.ah_attr.type != RDMA_AH_ATTR_TYPE_ROCE) + cm_process_routed_req(req_msg, work->mad_recv_wc->wc); memset(&work->path[0], 0, sizeof(work->path[0])); if (cm_req_has_alt_path(req_msg)) -- 2.30.2