diff mbox

[rdma-core,5/7] acm: Fix incorrect TID masking

Message ID 1489508474-16664-6-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe March 14, 2017, 4:21 p.m. UTC
The kernel uses the upper 32 bits of the TID for the agent ID
(see drivers/infiniband/core/user_mad.c ib_umad_write)

This worked on x86 because the TID is in BE at this point and the upper
32 bit masking is correct when working with BE data.

Noticed by sparse.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 ibacm/src/acm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index f3512dac106815..cf107815221b14 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2770,8 +2770,8 @@  static void acmc_recv_mad(struct acmc_port *port)
 	found = 0;
 	pthread_mutex_lock(&port->lock);
 	list_for_each(&port->sa_pending, req, entry) {
-		/* The lower 32-bit of the tid is used for agentid in umad */
-		if (req->mad.sa_mad.mad_hdr.tid == (hdr->tid & 0xFFFFFFFF00000000ULL)) {
+		/* The upper 32-bit of the tid is used for agentid in umad */
+		if (req->mad.sa_mad.mad_hdr.tid == (hdr->tid & htobe64(0xFFFFFFFF))) {
 			found = 1;
 			list_del(&req->entry);
 			port->sa_credits++;