Blame SOURCES/0001-ibacm-incorrect-usage-of-be-byte.patch

95af3a
commit e2c3c3fefa26287dcce1e70634792cff47d775ff
95af3a
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
95af3a
Date:   Mon Oct 16 10:24:21 2017 -0400
95af3a
95af3a
    ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast()
95af3a
    
95af3a
    The MLID value passed to ibv_attach/detach_mcast() must be in host
95af3a
    byte order.
95af3a
    
95af3a
    acmp.c incorrectly uses the big endian format when doing a multicast
95af3a
    attach/detach (join). Multicast packets are used to do name resolution
95af3a
    by the libibacmp library.
95af3a
    
95af3a
    There are two possible results because of this issue.
95af3a
    
95af3a
    If a kernel has commit 8561eae60ff9, the attach will fail with an
95af3a
    EINVAL.  ibacm will log this as a failure during the multicast join.
95af3a
    
95af3a
    If a kernel does not have commit 8561eae60ff9, the attach will
95af3a
    complete successfully.  Packets sent to this address will be dropped
95af3a
    because the packet dlid value and the multicast address information
95af3a
    given by the attach will not match.
95af3a
    
95af3a
    Update MLID usage to use the correct byte order.
95af3a
    
95af3a
    Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
95af3a
    Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
95af3a
    Signed-off-by: Doug Ledford <dledford@redhat.com>
95af3a
95af3a
diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
95af3a
index aa784166..78d9a295 100644
95af3a
--- a/ibacm/prov/acmp/src/acmp.c
95af3a
+++ b/ibacm/prov/acmp/src/acmp.c
95af3a
@@ -732,7 +732,7 @@ static void acmp_process_join_resp(struct acm_sa_mad *sa_mad)
95af3a
 			acm_log(0, "ERROR - unable to create ah\n");
95af3a
 			goto out;
95af3a
 		}
95af3a
-		ret = ibv_attach_mcast(ep->qp, &mc_rec->mgid, mc_rec->mlid);
95af3a
+		ret = ibv_attach_mcast(ep->qp, &dest->mgid, dest->av.dlid);
95af3a
 		if (ret) {
95af3a
 			acm_log(0, "ERROR - unable to attach QP to multicast group\n");
95af3a
 			ibv_destroy_ah(dest->ah);
95af3a
@@ -1429,7 +1429,7 @@ static void acmp_ep_join(struct acmp_ep *ep)
95af3a
 
95af3a
 	if (ep->mc_dest[0].state == ACMP_READY && ep->mc_dest[0].ah) {
95af3a
 		ibv_detach_mcast(ep->qp, &ep->mc_dest[0].mgid,
95af3a
-				 be16toh(ep->mc_dest[0].av.dlid));
95af3a
+				 ep->mc_dest[0].av.dlid);
95af3a
 		ibv_destroy_ah(ep->mc_dest[0].ah);
95af3a
 		ep->mc_dest[0].ah = NULL;
95af3a
 	}