From patchwork Mon Oct 16 14:19:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael J. Ruhl" X-Patchwork-Id: 10008453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E82C60235 for ; Mon, 16 Oct 2017 14:19:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5C2285C5 for ; Mon, 16 Oct 2017 14:19:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24485285C8; Mon, 16 Oct 2017 14:19:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD211285C5 for ; Mon, 16 Oct 2017 14:19:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753093AbdJPOTt (ORCPT ); Mon, 16 Oct 2017 10:19:49 -0400 Received: from mga03.intel.com ([134.134.136.65]:26085 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753056AbdJPOTr (ORCPT ); Mon, 16 Oct 2017 10:19:47 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2017 07:19:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,387,1503385200"; d="scan'208";a="161022304" Received: from sedona.ch.intel.com ([143.182.228.65]) by orsmga005.jf.intel.com with ESMTP; 16 Oct 2017 07:19:46 -0700 Received: from phlsvsles11.ph.intel.com (phlsvsles11.ph.intel.com [10.228.195.43]) by sedona.ch.intel.com (8.13.6/8.14.3/Standard MailSET/Hub) with ESMTP id v9GEJjhP007633; Mon, 16 Oct 2017 07:19:46 -0700 Received: from phlsvslse11.ph.intel.com (localhost [127.0.0.1]) by phlsvsles11.ph.intel.com with ESMTP id v9GEJj4j011302; Mon, 16 Oct 2017 10:19:45 -0400 Subject: [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast() To: sean.hefty@intel.com From: "Michael J. Ruhl" Cc: linux-rdma@vger.kernel.org, hal@dev.mellanox.co.il Date: Mon, 16 Oct 2017 10:19:45 -0400 Message-ID: <20171016141945.11276.1068.stgit@phlsvslse11.ph.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael J. Ruhl The MLID value passed to ibv_attach/detach_mcast() must be in host byte order. acmp.c incorrectly uses the big endian format when doing a multicast attach/detach (join). Multicast packets are used to do name resolution by the libibacmp library. There are two possible results because of this issue. If a kernel has commit 8561eae60ff9, the attach will fail with an EINVAL. ibacm will log this as a failure during the multicast join. If a kernel does not have commit 8561eae60ff9, the attach will complete successfully. Packets sent to this address will be dropped because the packet dlid value and the multicast address information given by the attach will not match. Update MLID usage to use the correct byte order. Reviewed-by: Mike Marciniszyn Signed-off-by: Michael J. Ruhl --- ibacm/prov/acmp/src/acmp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c index aa78416..78d9a29 100644 --- a/ibacm/prov/acmp/src/acmp.c +++ b/ibacm/prov/acmp/src/acmp.c @@ -732,7 +732,7 @@ static void acmp_process_join_resp(struct acm_sa_mad *sa_mad) acm_log(0, "ERROR - unable to create ah\n"); goto out; } - ret = ibv_attach_mcast(ep->qp, &mc_rec->mgid, mc_rec->mlid); + ret = ibv_attach_mcast(ep->qp, &dest->mgid, dest->av.dlid); if (ret) { acm_log(0, "ERROR - unable to attach QP to multicast group\n"); ibv_destroy_ah(dest->ah); @@ -1429,7 +1429,7 @@ static void acmp_ep_join(struct acmp_ep *ep) if (ep->mc_dest[0].state == ACMP_READY && ep->mc_dest[0].ah) { ibv_detach_mcast(ep->qp, &ep->mc_dest[0].mgid, - be16toh(ep->mc_dest[0].av.dlid)); + ep->mc_dest[0].av.dlid); ibv_destroy_ah(ep->mc_dest[0].ah); ep->mc_dest[0].ah = NULL; }