public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael J. Ruhl" <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Subject: [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast()
Date: Mon, 16 Oct 2017 10:19:45 -0400	[thread overview]
Message-ID: <20171016141945.11276.1068.stgit@phlsvslse11.ph.intel.com> (raw)

From: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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 <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 ibacm/prov/acmp/src/acmp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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;
 	}

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2017-10-16 14:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 14:19 Michael J. Ruhl [this message]
     [not found] ` <20171016141945.11276.1068.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 14:19   ` [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault Michael J. Ruhl
     [not found]     ` <20171016141950.11276.59779.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 14:22       ` Ruhl, Michael J
2017-10-16 14:24   ` [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast() Ruhl, Michael J
  -- strict thread matches above, loose matches on Subject: below --
2017-10-13 18:43 Michael J. Ruhl
     [not found] ` <20171013184347.28410.87093.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-13 19:37   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373AB19E97E-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-10-13 20:34       ` Ruhl, Michael J
2017-10-16  4:56   ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171016141945.11276.1068.stgit@phlsvslse11.ph.intel.com \
    --to=michael.j.ruhl-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox